
Java Practice 1
1. The data defined by the class are referred to as member variables or
instance variables
A.True
B.False
2 . What a Java programmer calls a __________ , a C/C++ programmer calls
a function
A.Classes
B.Method
C.Function
D.Object
3 . Each method or variable in a class may be marked private or public
A.True
B.False
4 . _____________ is the process by which one object acquires the
properties of another object
A.Encapsulation
B.Class
C.Inheritence
D.Polymorphism
5 . _________ is a feature that allows one interface to be used for a general
class of actions.
A.Encapsulation
B.Class
C.Inheritence
D.Polymorphism
6 . In Java, a source file is officially called a compilation unit.
A.True
B.False

7 . The Java compiler requires that a source file use the ________ filename
extension
A..h
B.. java
C.>java
D..class
8 . When Java source code is compiled, each individual class is put into its
own output file named after the class and using the ______ extension
A..h
B.. java
C.>java
D..class
9 . Comments in Java Program must begin with /* and end with */
A.True
B.False
10 . All statements in Java end with a _____________
A.Colon
B.SemiColon
C.Hypen
D.Dot
11 . The simplest form of the for loop in Java is for(initialization; condition;
iteration) statement;
A.True
B.False
12 . Java allows two or more statements to be grouped into blocks of code
called Code Blocks
A.True
B.False
13 . You do not need to follow any special indentation rules in Java
A.True

B.False
14 . Java is Case ________
A.Insensitive
B.Sensitive
15 . A constant value in Java is created by using a literal representation of
it
A.True
B.False
16 . The keywords const and goto are reserved but not used
A.True
B.False
17 . The Separator [ ] is Used to declare array types
A.True
B.False
18 . enum is a Keyword in Java, introduced from J2SE 5
A.True
B.False
19 . Java's built-in methods are members of the System class, which is a
class predefined by Java that is automatically included in your programs
A.True
B.False
20 . The print( ) method is just like println( ), except that it does not output a
newline character after each call
A.True
B.False
1 . The Java interpreter is used for the execution of the source code.
A.True
B.False

2 . On successful compilation a file with the .exe extension is created.
A.True
B.False
3 . The Java source code can be created in a Notepad editor.
A.True
B.False
4 . The Java Program is enclosed in a class definition.
A.True
B.False
5 . Class and main() methods declarations are required for every Java
application?
A.True
B.False
6 . Java Compiler and Java Interpreter are the two parts in executing a Java
program.
A.True
B.False
7 . Encapsulation, Inheritance and Polymorphism are the three OOPs
principles.
A.True
B.False
8 . Java source code file is a compilation unit.
A.True
B.False
9 . What output is displayed as the result of executing the following
statement? System.out.println("// Looks like a comment."); // Looks like a
comment
A.Looks like a comment
B.The statement results in a compilation error
C.No output is displayed

10 . In order for a source code file, containing the public class Test, to
successfully compile, which of the following must be true?
A.It must have a package statement
B.It must be named Test.java
C.It must import java.lang
D.It must declare a public class named Test
11 . Void is the return type of program's main( ) method.
A.True
B.False
12 . string array is the argument type of program's main( ) method.
A.True
B.False
13 . __________ will be automatically invoked when an object is created.
A.Method
B.Constructor
C.Function
14 . method has to be call explicitly.
A.True
B.False
15 . loading the driver and making the connection are the steps involved in
establishing a connection of JDBC.
A.True
B.False
16 . In JDBC ______________ used to create an instance of a driver and
register it with the DriverManager. When you have loaded a driver, it is
available for making a connection with a DBMS.
A.Class.forDriver
B.Class.forData
C.Class.forName

