Java Programming Fundamentals

Test your knowledge of Java programming concepts including collections, inheritance, exception handling, access modifiers, data types, and object-oriented programming principles.

15 Questions Published

Questions

Question 1 True/False

String buffer objects are mutable.

  1. True
  2. False
Question 2 Multiple Choice (Single Answer)

consider the following classes.(class A,class B,class C) which comes under multilevel inheritance?

  1. class A,class B extends A,class C extends B
  2. class A implements B,implements C
  3. class A extends B,extends C
  4. none of the above
Question 3 Multiple Choice (Single Answer)

In Java, static means

  1. one per method
  2. one per object
  3. one per class
  4. one per package
Question 4 Multiple Choice (Single Answer)

Which access modifier allows to access only within the package?

  1. public
  2. private
  3. default(no access modifier)
  4. protected
Question 5 Multiple Choice (Single Answer)

Automatic conversion between the primitives and the object wrapper class is called

  1. Autounboxing
  2. Autoboxing
  3. polymorphism
  4. encapsulation
Question 6 Multiple Choice (Single Answer)

consider the following classes. Class A, Class B extends A, Class C extends B. if we instantiate an object, which order the constructor of the above classes get executed?

  1. A,C,B
  2. C,B,A
  3. A,B,C
  4. none of the above
Question 7 Multiple Choice (Single Answer)

What results from attempting to compile and run the following code? public class Ternary{ public static void main(String args[]){ int a = 5; System.out.println("Value is - " + ((a < 5) ? 9.9 : 9)); } }

  1. 9.9
  2. 9
  3. 9.0
  4. None of the above
Question 8 Multiple Choice (Single Answer)

What will be the result of executing the following code? 1. boolean a = true; 2. boolean b = false; 3. boolean c = true; 4. if (a == true) 5. if (b == true) 6. if (c == true) System.out.println("Some things are true in this world"); 7. else System.out.println("Nothing is true in this world!"); 8. else if (a && (b = c)) System.out.println("It's too confusing to tell"); 9. else System.out.println("Hey this won't compile");

  1. The code won't compile
  2. Some things are true in this world
  3. Hey this won't compile
  4. none of the above
Question 9 Multiple Choice (Single Answer)

The class AssertionError has "is - a" relationship with which of these classes:

  1. RuntimeException
  2. Error
  3. VirtualMachineError
  4. IllegalAccessException
Question 10 Multiple Choice (Single Answer)

Which of the following uses the same number of bits as the double primitive variable?

  1. int
  2. byte
  3. float
  4. long
Question 11 Multiple Choice (Single Answer)

If you add int wit a byte , what will be the result?

  1. Int
  2. Byte
  3. Float
  4. None of the above
Question 12 True/False

float fl = 1.2;

  1. True
  2. False
Question 13 Multiple Choice (Single Answer)

A program written in the Java programming language can run on any platform because...

  1. Java programming is derived from C++.
  2. The Java Virtual Machine1(JVM) interprets the program for the native operating system.
  3. The compiler is identical to a C++ compiler.
  4. The APIs do all the work.
Question 14 Multiple Choice (Single Answer)

What is the legal range of a byte integral type?

  1. 0 - 65, 535
  2. (-128) - 127
  3. (-32,768) - 32,767
  4. (-256) - 255
Question 15 Multiple Choice (Multiple Answers)

Which of the following collection classes from java.util package are Thread safe?

  1. Vector
  2. HashMap
  3. ArrayList
  4. Hashtable