0

programming languages Online Quiz - 18

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

What is the result of trying to compile and run the following code. public final static void main(String[] args){ double d = 10.0 / -0; if(d == Double.POSITIVE_INFINITY) System.out.println("Positive infinity"); else System.out.println("Negative infinity"); }

  1. output Positive infinity

  2. output Negative infinity

  3. Will fail to compile

  4. Runtime exception


Correct Option: A
  1. int i = 0XCAFE;

  2. boolean b = 0;

  3. char c = A;

  4. byte b = 128;

  5. char c = "A";


Correct Option: A

What will happen if you try to compile and run this ? public class Test{ static{ print(10); } static void print(int x){ System.out.println(x); System.exit(0); } }

  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.

  5. It will run and print "10" and then crash with an error.


Correct Option: C

The range of a byte is from -127 to 128.

  1. True

  2. False


Correct Option: B
  1. float f = \u0038;

  2. long L2 = 2L;

  3. float f = 1.2;

  4. char c = '/u004E';

  5. byte b = 100;


Correct Option: C

What attributes do all real world objects have?

  1. size and weight

  2. identity, state, and behavior

  3. state and behavior

  4. height and shape


Correct Option: B

What is another name for creating an object?

  1. initialization

  2. instantiation

  3. inheritance

  4. insubordination


Correct Option: B

Short-circuit parameters are && and ||

  1. True

  2. False


Correct Option: A
  1. a. if

  2. b. implements

  3. c. private

  4. d. delegates


Correct Option: B
- Hide questions