Object Oriented Programming - I (3140705) MCQs

MCQs of Introduction to java and elementary programming

Showing 91 to 95 out of 95 Questions
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
Answer:

Option (c)

92.
Select from among the following character escape code which is not available in Java.
(a) \t
(b) \r
(c) \a
(d) \\
Answer:

Option (c)

93.
What will be the output?

if(1 + 1 + 1 + 1 + 1 == 5){
        System.out.print("TRUE");
}
else{
        System.out.print("FLASE");
}
(a) TRUE
(b) FALSE
(c) Compiler Error
(d) None of these
Answer:

Option (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
Answer:

Option (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
Answer:

Option (c)

Showing 91 to 95 out of 95 Questions