Java - MCQ

Multiple Choice Questions


Share with a Friend

 

Java MCQ - Introduction to Java - Set 19

91. What is the output of the following program ?

class Numbers{
        public static void main(String args[]){
                int a=20, b=10;
                if((a < b) && (b++ < 25)){
                        System.out.println("This is any language logic");
                }
                System.out.println(b); 
        }
}
A). 12
B). 11
C). 10
D). 23
View Answer
Correct: C



92. Select from among the following character escape code which is not available in Java.
A). \t
B). \r
C). \a
D). \
View Answer
Correct: C



93. What will be the output?

if(1 + 1 + 1 + 1 + 1 == 5){
        System.out.print("TRUE");
}
else{
        System.out.print("FALSE");
}
A). TRUE
B). FALSE
C). Compiler Error
D). None of these
View Answer
Correct: A



94. What will be output?

public class Test
{
 public static void main(String args[])
{
  System.out.print(""=="");
  System.out.print(" ");
  System.out.print("A"=="A");
  System.out.print(" ");
  System.out.print("a==A");
 }
}
A). "==" A"=="A a==A
B). true true false
C). true true a==A
D). Compilation Fails
View Answer
Correct: C



95. Determine output:

public class Test{
      static int i = 5;
      public static void main(String... args){
            System.out.println(i++);
            System.out.println(i);
            System.out.println(++i);
            System.out.println(++i+i++);
      }
}
A). 6 6 6 16
B). 6 7 6 16
C). 5 6 7 16
D). 5 6 6 16
View Answer
Correct: C



 
 
 
   
   
   
UltraInfo Technologies
ITDeveloper