Java Programming Fundamentals
Test your knowledge of Java programming language concepts including interfaces, abstract classes, exceptions, method overriding, and Hungarian notation.
Questions
Overridden method is in child class and Overriding method is in parent class.
- True
- False
we cannot override a non-abstract method as abstract.
- True
- False
class P { public void doIt() {} } class C extends P { private void doIt() {}} It is not legal.
- True
- False
Java is a
- Iterpreted Language
- Compiled Language
- Byte Code Language
- None of these
The main method has to be "public static" because of the following reasons. (Two options)
- static because it has to be constant and cannot be changed.
- static because it has to be loaded by the JVM without instantiating it
- public because other classes may also call the main method of a class
- public because JVM has to have access to the main method in order to call it.
Which of the following are valid main method declarations?
- static public void main(String []args)
- public static void main(String heyhey[])
- public static int main(String[] args)
- public static void main(String ...args)
- public static void main (String [], int argv)
Checked Exceptions are
- all sub-classes of Throwable
- not the sub classes of RuntimeException
- all sub-classes of Error
- None of these
int i=5; int a = + --i/2.0;
- Does not compile saying binary operator has invalid use
- 2.0
- 2.5
- exception will be thrown
Consider the following declarations ... float f = 4.5; //1 double d = 9.22; //2 short s = 3; //3 char c = s; //4 Which lines will throw error if any?
- 1 and 4
- 1
- 2 and 3
- 3 and 4
- no error
What gets printed here... System.out.println("Sum of 5 and 3 is:"+5+3);
- Sum of 5 and 3 is:8
- error during compilation
- Sum of 5 and 3 is:53
- None of these
Based on the description above, we could say that the variable name "lAccountNum" follows the Systems Hungarian Notation.
- True
- False
Based on Simonyi's convention, the notation "w" implies:
- a byte
- a word
- a boolean
- a null-terminated string
"fBusy" represents a variable of the following data type:
- floating-point
- double
- boolean
- function
Given the above scenario, the variable name "aulColors" represents:
- an array of unsigned long
- an array of floating-point values
- an array of unary
- an array of zero-terminated strings
The variable "g_nWheels" follows the Hungarian notation.
- True
- False
All variables in an Interface are by default __________.
- public
- final
- static
- all the above
- there should not be any variable in an interface
An Interface can only have public members whereas an abstract class can contain private as well as protected members
- True
- False
Abstract class's can have a constructor.
- True
- False
which of these is false?
- a class implements one or more interfaces
- a class extends one or more interfaces
- an interface extends one of more interfaces
- Serializable is a marker Interface
The following interface is valid. public interface Marker { }
- True
- False