Java Programming Fundamentals
Test your knowledge of Java programming concepts including collections, inheritance, exception handling, access modifiers, data types, and object-oriented programming principles.
Questions
String buffer objects are mutable.
- True
- False
consider the following classes.(class A,class B,class C) which comes under multilevel inheritance?
- class A,class B extends A,class C extends B
- class A implements B,implements C
- class A extends B,extends C
- none of the above
In Java, static means
- one per method
- one per object
- one per class
- one per package
Which access modifier allows to access only within the package?
- public
- private
- default(no access modifier)
- protected
Automatic conversion between the primitives and the object wrapper class is called
- Autounboxing
- Autoboxing
- polymorphism
- encapsulation
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?
- A,C,B
- C,B,A
- A,B,C
- none of the above
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)); } }
- 9.9
- 9
- 9.0
- None of the above
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");
- The code won't compile
- Some things are true in this world
- Hey this won't compile
- none of the above
The class AssertionError has "is - a" relationship with which of these classes:
- RuntimeException
- Error
- VirtualMachineError
- IllegalAccessException
Which of the following uses the same number of bits as the double primitive variable?
- int
- byte
- float
- long
If you add int wit a byte , what will be the result?
- Int
- Byte
- Float
- None of the above
float fl = 1.2;
- True
- False
A program written in the Java programming language can run on any platform because...
- Java programming is derived from C++.
- The Java Virtual Machine1(JVM) interprets the program for the native operating system.
- The compiler is identical to a C++ compiler.
- The APIs do all the work.
What is the legal range of a byte integral type?
- 0 - 65, 535
- (-128) - 127
- (-32,768) - 32,767
- (-256) - 255
Which of the following collection classes from java.util package are Thread safe?
- Vector
- HashMap
- ArrayList
- Hashtable