0

programming languages Online Quiz - 209

Description: programming languages Online Quiz - 209
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

What is the result that will be printed out ? void aMethod() { float f = (1 / 4) * 10; int i = Math.round(f); System.out.println(i); }

  1. Compiler error.

  2. Compiles and runs printing out 2

  3. Compiles and runs printing out 1

  4. An ArrayIndexOutOfBounds Exception at runtime


Correct Option: B
  1. . Compiler error.

  2. Will throw a NoSuchMethod error at runtime.

  3. It will compile and run printing out "10"

  4. It will run with no output.


Correct Option: B

ZZZ (Duplicate) - What is the output of the following, StringBuffer sb1 = new StringBuffer("Debopam"); StringBuffer sb2= new StringBuffer("Debopam "); String ss1 = " Debopam "; System.out.println(sb1==sb2); System.out.println(sb1.equals(sb2)); System.out.println(sb1.equals(ss1)); System.out.println("Poddar".substring(3));

  1. false false false dar

  2. false true false Poddar

  3. Compiler Error

  4. true true FALSE dar


Correct Option: A

Identify whether the following statement is true or false.
The keyword synchronized can be used with only a method

  1. True

  2. False


Correct Option: A

Identify whether the following statement is true or false.
The run () method should necessary exist in classes created as subclass of Thread

  1. True

  2. False


Correct Option: A

What is the purpose of the toolkit in the Abstract Window Toolkit (AWT)?

  1. To repair broken frames

  2. To create custom components

  3. An interface between the abstract window layer and windowing implementation

  4. To facilitate multicolor printing


Correct Option: C

What is an interface class?

  1. A collection of method declarations and constant values

  2. An abstract base class

  3. A way to get multiple inheritance

  4. A way to inherit variables and method implementations


Correct Option: A

Vertical and horizontal scroll bar increments are how many units by default?

  1. 12.5 units

  2. 100 units

  3. 5 units

  4. 1 unit


Correct Option: D

Reflection (introspection) is querying a class about its properties, and operating on methods and fields by the name for a given object instance. Why is reflection possible in the Java language?

  1. Late binding

  2. Early binding

  3. Java developers are very introspective people

  4. Reflection is possible in all languages


Correct Option: A

The StringBuffer class supports what type of strings?

  1. Mutable (changeable)

  2. Immutable (unchangeable)

  3. Violins and cellos

  4. Rotated and scaled


Correct Option: A

Why does an Assert class that checks program assertions need several implementations of its assert method?

  1. The Java language has loose type checking

  2. The Java language has tight type checking

  3. To keep tabs on garbage collection

  4. You never know how many you need, so you should always cover the most obvious cases


Correct Option: B
  1. Divide by zero error

  2. Accessing the elements of an array beyond its range

  3. Invalid input

  4. Opening an empty file

  5. Hard disk crash


Correct Option: A,B,C,E
- Hide questions