









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Q2: What should be maximum length of identifier names in java? a. 8 chars b. 32 chars c. 256 chars d. No max length Q3: What is the range of int? a. (^) -128 to 127 b. 0 to 65535 c. -32768 to 32767 d. -2147483648 to 2147483647 Q4: class Sample{ public static void main(Stringfloat x=10.0; args){ System.out.println(x); }} a. 10. b. 10 c. Compile time error d. Runtime error Q5: class Sample{ byte x=128;public static void main(String^ args){ x++; } System.out.println(x); } a. 128 b. - c. Compile time error d. Runtime error Q6: Which Line is invalid
class Sample{public static void main(String args){ float x=10;char p=x; //Line char q=(char)x;char r=10.0f; //Line2//Line }char s=(byte)10.0;^ //Line } Q7: Which is invalid options (multipal)? a. int a = 10; b. int b = 20; c. int c = a + b; d. int i1 = 10; e. float f1 = 20; f. float f2 = i1 + f1; g. int i = i1 + f1; h. byte b1 = 10; i. byte b2 = 20; j. byte b 3 = b1 + b2; Q8: How many way of comparing string objects? a. Using == operator b. Using != operator c. Using equals() method d. Using equalsIgnoreCase() method e. Using >= operator Q9: What is output? class Sample{public static void main(String[] args){ String s1="ABC";String s2=s1; s1=s1+"XYZ";System.out.println(s1==s2); System.out.println(s1);System.out.println(s2); } } Q10: What is output?class Sample{
Q16: Which of the following are not java keywords? a. double b. switch
Q19: Java identifiers are case in-sensitive? a. True b. False Q20: What coding standard should follow for class name? a. All character should be in upper case b. All character should be in lower case c. First character should be lower case character and all inner words should start with upper case character d. First character and allcharacter inner words should start with upper case
Q21: What coding standard should follow for variable name? a. All character should be in upper case b. (^) All character should be in lower case c. First character should bewords should start with upper lower case case character character and all inner d. First character and all inner words should start with upper case character Q22: What coding standard should follow for method name? a. All character should be in upper case
b. All character should be in lower case c. First character shouldwords should start with be upper lower case case character character and all inner d. First character and all inner words should start with upper case character Q23: What coding standard should follow for final variable name? a. All character should be in upper case b. All character should be in lower case c. First character should be lower case character and all inner words should start with upper case character d. First character and allcharacter inner words should start with upper case
Q24: According to java coding standard which is valid variable name? a. studentfee b. Studentfee c. STUDENTFEE d. studentFee Q25: What is the size of byte data type? a. 1 byte b. 2 byte c. 4 byte d. Undefined Q26: What is the size of short data type? a. 1 byte b. 2 byte c. 4 byte d. Undefined Q27: What is the size of char data type? a. 1 byte b. 2 byte c. 4 byte d. Undefined Q28: What is the size of int data type? a. 2 byte b. 4 byte c. 8 byte d. Undefined
Q36: What is the range of int? a. -128 to 127 b. 0 to 65535 c. -32768 to 32767 d. (^) -2147483648 to 2147483647 Q37: What is the range of long? a. -2^31 to 2 31 - b. -2^63 to 2 63 - c. -2^64 to 2 64 - d. -3.410^38 to 3.410 38 e. -1.710^308 to 1.710 308 Q38: What is the range of float? a. -2^31 to 2 31 - b. -3.410^38 to 3.410 38 c. -3.410^38 to 3.410 38 - d. (^) -1.710^308 to 1.710 308 e. -1.710^308 to 1.710 308 - Q39: What is the range of double? a. -2^31 to 2 31 - b. -3.410^38 to 3.410 38 c. -3.410^38 to 3.410 38 - d. -1.710^308 to 1.710^308 e. -1.710^308 to 1.710 308 - Q40: Identify invalid assignment? a. short = byte b. char = byte c. int = byte d. long = byte Q41: Identify invalid assignment? a. float = byte b. double = byte c. boolean = byte d. byte = byte Q42: Identify invalid assignment? a. byte = short b. short = short
c. char = short d. int = short Q43: Identify invalid assignment? a. long = short b. float = short c. double = short d. boolean = short Q44: Identify invalid assignment? a. byte = char b. short = char c. char = char d. int = char Q45: Identify invalid assignment? a. long = char b. float = char c. double = char d. boolean = char Q46: Identify valid assignment? a. byte = int b. short = int c. char = int d. int = int Q47: Identify invalid assignment? a. long = int b. float = int c. double = int d. boolean = int Q48: Identify invalid assignment? a. byte = long b. short = long c. char = long d. int = long e. all Q49: Identify invalid assignment? a. long = long b. float = long
c. Compile time error d. Runtime error Q56: byte x=10;x=x+1; System.out.println(x); a. 11 b. 10 c. Compile time error d. Runtime error Q57: byte x=10; System.out.println(x);x=(byte)x+1; a. 11 b. Compile time error c. Runtime error Q58: byte x=10;x=(byte)(x+1); System.out.println(x); a. 11 b. Compile time error c. Runtime error Q59: byte x=10; x++;System.out.println(x); a. 11 b. Compile time error c. Runtime error
Q60: byte x=10;x=x+1; System.out.println(x);} a. 11 b. Compile Time Error: Possible Loss of Precision c. Compile Time Error: Incompatible Types d. (^) Compile Time Error: Inconvertible Types Q61: byte x=true;System.out.println(x);
a. 11 b. Compile Time Error: Possible Loss of Precision c. Compile Time Error: Incompatible Types d. Compile Time Error: Inconvertible Types Q62: byte x=(byte)true; System.out.println(x); a. 11 b. Compile Time Error: Possible Loss of Precision c. Compile Time Error: Incompatible Types d. Compile Time Error: Inconvertible Types Q63: byte x=(byte)ā10ā; System.out.println(x); a. 11 b. Compile Time Error: Possible Loss of Precision c. Compile Time Error: Incompatible Types d. Compile Time Error: Inconvertible Types Q64: byte x=128; System.out.println(x); a. 128 b. - c. Compile Time Error: Possible Loss of Precision d. (^) Compile Time Error: Incompatible Types e. Compile Time Error: Inconvertible Types Q65: byte x=āAā;System.out.println(x); a. A b. Compile Time Error: Possible Loss of Precision c. 65 d. Compile Time Error: Inconvertible Types Q66: byte x=(byte)260;System.out.println(x); a. 260 b. 4 c. Compile Time Error: Possible Loss of Precision d. Compile Time Error: Incompatible Types Q67: byte x=10;byte y=20;
Q73: == operator will compares a. Addresses of two string objects b. Contents of two string objects c. State of two string objects d. Identity of two string objects Q74: equals() method will compares a. Addresses of two string objects b. Contents of two string objects c. State of two string objects d. Identity of two string objects Q75: equalsIgnoreCase() methodstring objects in case insensitive will manorscompares state/contents of two a. True b. False Q76: What is output class Sample{public static void main(String[] args){ System.out.println("ABC"+10);System.out.println(10+"ABC");
} }
Q77: What is output? class Point{int x=10; int y=20; public String toString(){return x+","+y;
} } class Sample{public static void main(String[] args){ Point p=new Point();System.out.println(p);
} }