Home » Java » Java Interview Questions on Networking
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.
Forum Level: ExpertCategory: 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.
Forum Level: PractitionerCategory: operators [Posted by: Admin | Chicago, USA]
Question: 3
(A) 10 (B) 11 (C) 12 (D) 13
Ans: A
Hint: Its postincrement operator here that is why println(a++); is evaluated as 10.
Forum Level: BeginnerCategory: 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.
Forum Level: BeginnerCategory: 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
Forum Level: BeginnerCategory: 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
Forum Level: BeginnerCategory: 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
Forum Level: BeginnerCategory: 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
Forum Level: BeginnerCategory: 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
Forum Level: BeginnerCategory: 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
Forum Level: BeginnerCategory: operators [Posted by: Admin | Chicago, USA]
Question: 11
(A) - (B) + (C) *
Ans: C
Hint: * has highest precedance among +, -
Forum Level: BeginnerCategory: operators [Posted by: Admin | Chicago, USA]
Question: 12
(A) | (B) ^ (C) ~ (D) <->
Ans: D
Forum Level: BeginnerCategory: 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
Ans: C
Forum Level: ExpertCategory: operators [Posted by: Admin | Chicago, USA]
Question: 14
(A) () (B) ++ (C) * (D) >=
Ans: A
Hint: () is solved first
Forum Level: BeginnerCategory: operators [Posted by: Admin | Chicago, USA]
Question: 15
(A) () (B) * (C) + (D) ++
Ans: D
Hint: ++, -- are unary operator
Forum Level: BeginnerCategory: operators [Posted by: Admin | Chicago, USA]
Question: 16
(A) >= (B) <= (C) != (D) +=
Ans: C
Hint: != is used to compare equality; x is not equal to y is represented as x != y
Forum Level: BeginnerCategory: 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
Ans: D
Forum Level: BeginnerCategory: 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
Forum Level: BeginnerCategory: other [Posted by: Admin | Chicago, USA]
Question: 19
(A) True (B) False
Ans: A
Forum Level: BeginnerCategory: variables [Posted by: Admin | Chicago, USA]
Question: 20
(A) True (B) False
Ans: A
Hint: main() method is must to run any Java program
Forum Level: BeginnerCategory: methods [Posted by: Admin | Chicago, USA]
Question: 21
(A) default (B) public (C) protected (D) All of these
Ans: D
Forum Level: PractitionerCategory: other [Posted by: Admin | Chicago, USA]
Question: 22
(A) True (B) False
Ans: A
Forum Level: BeginnerCategory: methods [Posted by: Admin | Chicago, USA]
Question: 23
(A) byte (B) short (C) long (D) class
Ans: D
Forum Level: BeginnerCategory: datatype [Posted by: Admin | Chicago, USA]
Question: 24
(A) 5 (B) 4 (C) 1 (D) 0
Ans: C
Hint: It is printed one time only because break; will terminate the current loop
Forum Level: BeginnerCategory: loops [Posted by: Admin | Chicago, USA]
Question: 25
(A) 5 (B) 4 (C) 3 (D) 2
Ans: C
Hint: It is printed 3 times becuase i is incremented 2 times for one iteration
Forum Level: BeginnerCategory: loops [Posted by: Admin | Chicago, USA]
Question: 26
(A) 5 (B) 4 (C) 3 (D) 2
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.
Forum Level: PractitionerCategory: loops [Posted by: Admin | Chicago, USA]
Question: 27
(A) 1 (B) 2 (C) 3 (D) 4
Ans: B
Hint: The loop is execuated 2 times only because i is incremented by 3 everytimne. i = 0; i=3; i=6;
Forum Level: PractitionerCategory: loops [Posted by: Admin | Chicago, USA]
Question: 28
(A) 0 (B) 1 (C) 2 (D) 3
Ans: C
Hint: For loop will run two times only for i=0; i=4
Forum Level: PractitionerCategory: 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
Forum Level: PractitionerCategory: loops [Posted by: Admin | Chicago, USA]
Question: 30
(A) 5 (B) 4 (C) 3 (D) 0
Ans: D
Hint: Nothing is printed because loop will not run; 0>5 is false condition
Forum Level: PractitionerCategory: loops [Posted by: Admin | Chicago, USA]
Question: 31
(A) 5 (B) 4 (C) 2 (D) 1
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
Forum Level: PractitionerCategory: 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
Forum Level: BeginnerCategory: 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
Forum Level: PractitionerCategory: 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
Forum Level: ExpertCategory: 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
Forum Level: ExpertCategory: conditional [Posted by: Admin | Chicago, USA]
Question: 36
(A) 5 (B) 10 (C) 100 (D) 0
Ans: D
Hint: default case is executed because the value of a is 0
Forum Level: PractitionerCategory: 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
Forum Level: ExpertCategory: conditional [Posted by: Admin | Chicago, USA]