Java Questions
- To override a method in Java, we need to define a method in sub class with the
- same name, same number of arguments having the same data types as a method in the super class (Ans)
- different name, same number of arguments having the same data type as a method in the super class
- same name but different number of arguments as a method in the super class
- same name, same number of arguments but different data types as a method in the super class
- A constructor that is automatically generated in the absence of explicit constructors called?
- Default Constructor
- Nullary Constructor
- Empty Constructor
- All the above (Ans)
- Choose best option that describes Constructor.
- Have no return type
- Use name of the class and have no return type (Ans)
- Use name of the class
- None of the above
- Overloaded methods are differentiated by
- Number of arguments
- Data type of arguments
- Number and the Data type of the arguments (Ans)
- None of the above
- Which keyword is used to inherit class?
- inherit
- extends (Ans)
- inheritance
- extend
- Which method of System class is used to copy array?
- copyArray
- arrayCopy
- arraycopy (Ans)
- arrCopy
- Which is right way to creating an array of integer?
- javaArray = new int[10];
- javaArray new = myArray[10];
- int[] javaArray = new int[10];
- A and C Both (Ans)
- Which is right way to declare Array?
- int[] myArray;
- int myArray[];
- int []myArray;
- A and B Both (Ans)
- How integer literal can expressed binary data?
- int binaryData = b11010;
- int binaryData = bx11010;
- int binaryData = 0b11010; (Ans)
- int binaryData = xb11010;
- If you access an uninitialized local variable will result?
- Syntax Error
- Compile Time Error (Ans)
- Run Time Error
- No Error
- How many type of Primitive Data Types exist in Java?
- 5
- 7
- 8 (Ans)
- 10
- A collection of methods with no implementation is called an ________.
- Polymorphism
- Inheritance
- Interface (Ans)
- Data Binding
- What is the correct signature of the main method?
- public static void main(String[] args)
- static public void main(String[] args)
- public void main(String[] args)
- A and B Both (Ans)
- Which is not a valid comment style in Java
- /* comment */
- /* comment (Ans)
- /** comment */
- // comment
- The Java programming language is a ________?
- Machine Level Language
- High Level Language (Ans)
- Assembly Level Language
- None of the above
- Which is not a valid keyword in java?
- null (Ans)
- transient
- synchronized
- native


No comments:
Post a Comment