CppBuzz
Java Interview Questions on Networking - 0 Questions Question: 1
(A) 10(B) 11(C) 12(D) Compilation Error
Ans: D
Hint: Preincrement & Postincrement operators are not allowed on same variable and same time.
Level: Expert Category: datatype [Posted by: Admin | Chicago, USA]
Question: 2
(A) 11(B) 12(C) 13(D) Compilation Error
Ans: D
Hint: It is evaluated as 10++; variable is required to perform ++ operator. Performing ++ on 10 is compilation error.
Level: Practitioner Category: operators [Posted by: Admin | Chicago, USA]
Question: 3
Ans: A
Hint: Its postincrement operator here that is why println(a++); is evaluated as 10.
Level: Beginner Category: operators [Posted by: Admin | Chicago, USA]
Question: 4
(A) 100(B) 110(C) 121(D) Compilation Error
Ans: A
Hint: It is evaluated as 10 * 10 beause a has postincrement operator.
Level: Beginner Category: operators [Posted by: Admin | Chicago, USA]
Question: 5
(A) 100(B) 110(C) 121(D) 144
Ans: B
Hint: It is evaluated as 10*11
Level: Beginner Category: variables [Posted by: Admin | Chicago, USA]
Question: 6
(A) 121(B) 132(C) 144(D) 100
Ans: A
Hint: It is evaluated as 11*11
Level: Beginner Category: operators [Posted by: Admin | Chicago, USA]
Question: 7
(A) 121(B) 144(C) 132(D) 100
Ans: C
Hint: It is evaluated as 11*12
Level: Beginner Category: operators [Posted by: Admin | Chicago, USA]
Question: 8
(A) 100(B) 90(C) 81(D) 80
Ans: A
Hint: It is evaluated as 10*10
Level: Beginner Category: operators [Posted by: Admin | Chicago, USA]
Question: 9
(A) 100(B) 90(C) 99(D) 72
Ans: B
Hint: It is evaluated as 10*9
Level: Beginner Category: variables [Posted by: Admin | Chicago, USA]
Question: 10
(A) 138(B) 264(C) 41(D) 25
Ans: D
Hint: It is evaluated as 5+10+4+6
Level: Beginner Category: operators [Posted by: Admin | Chicago, USA]
Question: 11
Ans: C
Hint: * has highest precedance among +, -
Level: Beginner Category: operators [Posted by: Admin | Chicago, USA]
Question: 13
(A) Left Shift Operator(B) Right Shift Operator(C) Zero Fill Right Shift(D) Zero Fill Left Shift
Level: Expert Category: operators [Posted by: Admin | Chicago, USA]
Question: 15
Ans: D
Hint: ++, -- are unary operator
Level: Beginner Category: operators [Posted by: Admin | Chicago, USA]
Question: 16
Ans: C
Hint: != is used to compare equality; x is not equal to y is represented as x != y
Level: Beginner Category: operators [Posted by: Admin | Chicago, USA]
Question: 17
(A) Local variables are declared in methods, constructors, or blocks(B) Local variables are created when the method, constructor or block is entered(C) the variable will be destroyed once it exits the method, constructor, or block(D) We can't create reference variables of Local variables
Level: Beginner Category: variables [Posted by: Admin | Chicago, USA]
Question: 18
(A) Windows(B) Mac OS(C) UNIX(D) All of these
Ans: D
Hint: Java is platform independent becuase it produces Byte code
Level: Beginner Category: other [Posted by: Admin | Chicago, USA]
Question: 20
Ans: A
Hint: main() method is must to run any Java program
Level: Beginner Category: methods [Posted by: Admin | Chicago, USA]
Question: 21
(A) default(B) public(C) protected(D) All of these
Level: Practitioner Category: other [Posted by: Admin | Chicago, USA]
Question: 23
(A) byte(B) short(C) long(D) class
Level: Beginner Category: datatype [Posted by: Admin | Chicago, USA]
Question: 24
Ans: C
Hint: It is printed one time only because break; will terminate the current loop
Level: Beginner Category: loops [Posted by: Admin | Chicago, USA]
Question: 25
Ans: C
Hint: It is printed 3 times becuase i is incremented 2 times for one iteration
Level: Beginner Category: loops [Posted by: Admin | Chicago, USA]
Question: 26
Ans: A
Hint: i++; will increment the value of i by 1 but in next statement i--; will drecrement the value of i by 1. Hence these two operations are not making any sense.
Level: Practitioner Category: loops [Posted by: Admin | Chicago, USA]
Question: 27
Ans: B
Hint: The loop is execuated 2 times only because i is incremented by 3 everytimne. i = 0; i=3; i=6;
Level: Practitioner Category: loops [Posted by: Admin | Chicago, USA]
Question: 28
Ans: C
Hint: For loop will run two times only for i=0; i=4
Level: Practitioner Category: loops [Posted by: Admin | Chicago, USA]
Question: 29
(A) 0(B) 1(C) 2(D) Infinite times
Ans: D
Hint: This for loop will run for i=0 only always becuase there is not increment/decrement operator
Level: Practitioner Category: loops [Posted by: Admin | Chicago, USA]
Question: 30
Ans: D
Hint: Nothing is printed because loop will not run; 0>5 is false condition
Level: Practitioner Category: loops [Posted by: Admin | Chicago, USA]
Question: 31
Ans: D
Hint: For loop will run only one time.First time it will run for i=0; Second time value of i becomes 5 that why 5<5; is false condition to stop the loop
Level: Practitioner Category: loops [Posted by: Admin | Chicago, USA]
Question: 32
(A) 5(B) 10(C) 0(D) Compilation Error
Ans: B
Hint: Value of a is 10 that is why case:10 is executed
Level: Beginner Category: conditional [Posted by: Admin | Chicago, USA]
Question: 33
(A) 5(B) 10(C) 510(D) Compilation Error
Ans: C
Hint: case 5 & case 10 are executed because break is missing from case 5
Level: Practitioner Category: conditional [Posted by: Admin | Chicago, USA]
Question: 34
(A) 5(B) 510(C) 5100(D) Compilation Error
Ans: C
Hint: case 5, case 10 and default will be executed because break; is missing after each case
Level: Expert Category: conditional [Posted by: Admin | Chicago, USA]
Question: 35
(A) 5(B) 510(C) 5100(D) 100
Ans: A
Hint: Value of a is 5 that is why case 5 is executed
Level: Expert Category: conditional [Posted by: Admin | Chicago, USA]
Question: 36
Ans: D
Hint: default case is executed because the value of a is 0
Level: Practitioner Category: conditional [Posted by: Admin | Chicago, USA]
Question: 37
(A) 10(B) 510(C) 5100(D) 100
Ans: D
Hint: case 10 and default are executed because the break is missing after case 10
Level: Expert Category: conditional [Posted by: Admin | Chicago, USA]
Question: 38
(A) Compilation Error(B) 10-even-(C) 10-even-0(D) 10-odd
Level: Expert Category: conditional [Posted by: Admin | Chicago, USA]
Question: 39
(A) Compilation Error(B) 10-even-(C) 10-odd-(D) 10-even-0
Level: Expert Category: conditional [Posted by: Admin | Chicago, USA]
Question: 40
(A) Compilation Error(B) Length is 5-10(C) Length not in 5-10(D) nothing is printed
Level: Practitioner Category: conditional [Posted by: Admin | Chicago, USA]