1) Java is a ___ programming language.
A) Functional
Explanation:
Everything in Java is implemented using Object-Oriented principles.
2) In Java programming language, the code is placed inside ___.
A) Classes, Interfaces
3) Properties are implemented using ___ in Java.
A) Methods
4) A Class in Java is like a ____.
A) Prototype
5) Which is the file extension used for a public Java class source code?
A) .j
6) Which is the file extension used for a compiled Java class file?
A) .j
7) State TRUE or FALSE.
The source-code of An Abstract-Class or Interface is kept inside a .java file.
A) FALSE
8) After compilation, an Interface or Abstract-Class is kept in a ___ file in Java programming.
A) .java
Explanation:
All compiled Java classes, interfaces and abstract classes are kept in a .class file only. All source files are kept in .java files.
9) State TRUE or FALSE. In Java, a public class or abstract-class or interface must be kept in a separate .java file.
A) FALSE
10) In a .java file, how many numbers of public types namely class, interface or abstract can be managed?
A) 1
Explanation:
Only one public type is allowed per .java file.
11) In Java, the keyword used to declare a class is ___.
A) Class
12) A Java class can contain___.
A) Variables
C) Inner Classes (A class inside another class)
13) How many maximum numbers of objects can be created from a single Class in Java?
A) 32
Explanation:
There is no limit on the number of objects being created from a class.
14) Creating an object from a class is also called ____.
A) Initializing
15) The keyword used to create a new object in Java is ___.
A) class
16) 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
Explanation:
These are also called Java naming rules.
17) An object is created at __ time in Java.
A) Compile-time
18) 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.
Explanation:
Java compiler does not complain about a missing main method.
19) Choose the correct syntax for declaring a Java class below.
Explanation:
Use the keyword class but not Class.
20) Choose the correct way of creating an object of the below class.
class Table
{
Table(){System.out.println("Table Created");}
}
B)
Table t = new Table();
C)
Table() t = new Table();