Test Series - java

Test Number 46/64

Q: In Java, the keyword used to declare a class is ___.
A. Class
B. Java
C. class
D. java
Solution: no solution
Q:  A Java class can contain___.
A. Variables
B. Methods, Constructors
C. Inner Classes (A class inside another class)
D. All the above
Solution: no solution
Q: How many maximum numbers of objects can be created from a single Class in Java?
A. 32
B. 64
C. 256
D. None
Solution: There is no limit on the number of objects being created from a class.
Q: Creating an object from a class is also called ____.
A. Initializing
B. Instantiating
C. Interfacing
D. None of the above
Solution: no solution
Q: The keyword used to create a new object in Java is ___.
A. class
B. java
C. new
D. create
Solution: no solution
Q: Choose the correct statements about choosing a name for a class in Java.
A. The class name can start with only a letter or underscore or dollar sign.
B. The class name can contain numbers
C. The class name can not start with a number
D. All the above
Solution: These are also called Java naming rules.
Q: An object is created at __ time in Java.
A. Compile-time
B. Run time
C.  Assembling time
D. None of the above
Solution: no solution
Q: Choose the correct statement about Java main method.
A. The main method is not a required method
B. The main method must be declared public static void.
C. you can define program flow using the main method. The Java virtual machine calls the main method directly.
D. All the above
Solution: Java compiler does not complain about a missing main method.
Q: Choose the correct syntax for declaring a Java class below.
A. class CLASSNAME { }
B. CLASSNAME class { }
C. class CLASSNAME; { }
D. Class CLASSNAME { }
Solution: Use the keyword class but not Class.
Q: Choose the correct way of creating an object of the below class.
class Table
{
  Table(){System.out.println("Table Created");}
}
A. Table t = new Table;
B. Table t = new Table();
C. Table() t = new Table();
D. None of the above
Solution: no solution

You Have Score    /10