JavaQuizzes

Quiz Guidelines

 

Multiple Choice Question

QID: 
12

Which of the following statements are true?

Select 1 option

A. For any non-null reference obj, the expression (obj instanceof obj) will always yield true.

B. For any non-null reference obj, the expression (obj instanceof Object) will always yield true.

C. For any non-null reference obj, the expression (obj instanceof obj) will always yield false.

D. For any non-null reference obj, the expression (obj instanceof Object) may yield false.

E. None of the above

Multiple Choice Question

QID: 
13

Given:

class HelloWorld{

  public static void main (String[] args)
  {
    System.out.println("Hello World!");
  }

}

Select 1 option below, if the above class is declared in a file Hello.java:

A. Compilation will fail

B. Compilation succeeds, but execution fails with an exception

C. Compilation and execution succeeds and it prints 'Hello World!'

D. Compilation and execution succeeds and it prints nothing.

Multiple Choice Question

QID: 
14

Given:

public class HelloWorld{

  public static void main (String[] args)
  {
    System.out.println("Hello World!");
  }

}

Select 1 option below, if the above class is declared in a file Hello.java:

A. Compilation will fail

B. Compilation succeeds, but execution fails with an exception

C. Compilation and execution succeeds and it prints 'Hello World!'

D. Compilation and execution succeeds and it prints nothing.

Multiple Choice Question

QID: 
15

Given:

class HelloWorld{

  public static void main (String[] args)
  {
    System.out.println("Hello"+1*2+3);
  }

}

A. Compilation fail

B. Compilation succeeds, but execution will fail with an exception

C. Compile and run successfully and print Hello23

D. Compile and run successfully and print Hello123

Multiple Choice Question

QID: 
16

Given:

class HelloWorld{

  public static void main (String[] args)
  {
    System.out.println("Hello"+1+3-2);
  }

}

A. Compilation fail

B. Compilation succeeds, but execution will fail with an exception

C. Compile and run successfully and print Hello123

D. Compile and run successfully and print Hello11

Pages

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!