1. JVM Stands for ___________.
a. Java Virtual Machine
b. Java Verify Machine
c. Java Vector Machine
d. None of the above
Hide Answer ⟵
a. Java Virtual Machine
2. Java programs are _____________.
a. Platform Independent
b. Highly Portable
c. Both a) and b)
d. None of the above
Hide Answer ⟵
c. Both a) and b)
3. Java support __________.
a. Compiler
b. Interpreter
d. Assembler
e. None of the above
Hide Answer ⟵
b. Interpreter
4. Java converts the program in __________.
a. Byte
b. Megabyte
c. Bytecode
d. None of the above
Hide Answer ⟵
c. Bytecode
5. IDE Stands for __________.
a. Integrated Developer Environments
b. Integrated Development Environments
c. Internal Developer Environments
d. Internal Development Environments
Hide Answer ⟵
b. Integrated Development Environments
6. Java NetBeans IDE is ________ software.
a. Close source
b. Middle source
c. Open Source
d. None of the above
Hide Answer ⟵
c. Open Source
7. How we can write comments in Java programs.
a. Two forward slashes (//)
b. /* and */
c. Both a) and b)
d. None of the above
Hide Answer ⟵
c. Both a) and b)
8. In Java a group of related classes is known as _______.
a. Group
b. Package
c. Method
d. None of the above
Hide Answer ⟵
b. Package
9. In Java most common pre-built Java output methods are ___________.
a. [Link]();
b. Public class
c. Public static void main(String[] args)
d. None of the above
Hide Answer ⟵
a. [Link]();
10. A Variable is a placeholder for data that can change its value during
program execution.
a. Constant
b. Variable
c. Data type
d. None of the above
Hide Answer ⟵
b. Variable
11. In Java, How many types of primitive Data Type.
a. 6
b. 7
c. 8
d. 9
Hide Answer ⟵
c. 8
12. In Java, Which type of datatype is used to store Integer values.
a. Byte
b. Int
c. Long
d. All of the above
Hide Answer ⟵
d. All of the above
13. Int Data Type can store ________ bit of data.
a. 8-bit
b. 16-bit
c. 32-bit
d. 64-bit
Hide Answer ⟵
c. 32-bit
14. Float Data Type can store ________ bit of data.
a. 8-bit
b. 16-bit
c. 32-bit
d. 64-bit
Hide Answer ⟵
c. 32-bit
15. Double Data Type can store ________ bit of data.
a. 16-bit
b. 32-bit
c. 64-bit
d. 8-bit
Hide Answer ⟵
c. 64-bit
16. Char Datatype can store _________ bit of data.
a. 16-bit
b. 32-bit
c. 64-bit
d. 8-bit
Hide Answer ⟵
a. 16-bit
17. Boolean Data Type can store _________ bit of data.
a. 16-bit
b. 32-bit
c. 1-bit
d. 8-bit
Hide Answer ⟵
c. 1-bit
18. What are the naming rules we have to follow to declare a variable.
a. Variable names can begin with either an alphabetic character, Underscore
or a dollar sign.
b. Space are not allowed in variable names
c. Reserved words cannot be used as a variable name
d. All of the above
Hide Answer ⟵
d. All of the above
19. To store more than one character, we use the _______ data type.
a. Integer
b. Character
c. String
d. None of the above
Hide Answer ⟵
c. String
20. ___________ are special symbols in a programming language and
perform certain specific operations.
a. Operators
b. Variable
c. Datatype
d. None of the above
Hide Answer ⟵
a. Operators
21. ++ is known as which operator.
a. Increment Operator
b. Decrements Operator
c. Assignment Operator
d. Modulus
Hide Answer ⟵
a. Increment Operator
22. Which of the following belongs to logical operators.
a. &&
b. ||
c. !
d. All of the above
Hide Answer ⟵
d. All of the above
23. Which of the following is an example of selection structures.
a. If else statement
b. Switch statement
c. Else if statement
d. All of the above
Hide Answer ⟵
d. All of the above
24. The __________ in Java lets us execute a block of code depending
upon whether an expression evaluates to true or false.
a. If statements
b. For statements
c. Array Statements
d. None of the above
Hide Answer ⟵
a. If statements
25. To combine two relational expressions in a program.
a. Logical OR
b. Logical AND
c. Logical NOT
d. None of the above
Hide Answer ⟵
b. Logical AND
26. If inside the if is known as _________.
a. Outer If
b. Inner If
c. Nested If
d. All of the above
Hide Answer ⟵
c. Nested If
27. The ____________ is used to execute a block of code matching one
value out of many possible values.
a. If statement
b. Switch Statement
c. For Statement
d. None of the above
Hide Answer ⟵
b. Switch Statement
28. The ability of a computer to perform the same set of actions again
and again is called looping.
a. Looping
b. Actioning
c. Performing
d. None of the above
Hide Answer ⟵
a. Looping
29. What are the different looping statements available in Java?
a. For loop
b. While loop
c. Do-while loop
d. All of the above
Hide Answer ⟵
d. All of the above
30. The ________ statement evaluates the test before executing the body
of a loop.
a. Goto
b. While loop
c. Do-while loop
d. All of the above
Hide Answer ⟵
b. While loop
31. The __________ statement evaluates the test after executing the
body of a loop.
a. Goto
b. While loop
c. Do-while loop
d. All of the above
Hide Answer ⟵
c. Do-while loop
32. _________ is known as the entry control loop.
a. While loop
b. Do-while loop
c. Goto loop
d. All of the above
Hide Answer ⟵
a. While loop
33. __________ is known as the exit control loop.
a. While loop
b. Do-while loop
c. Goto loop
d. All of the above
Hide Answer ⟵
b. Do-while loop
34. Which condition required for executing the loop –
a. Initial value
b. Condition
c. Counter
d. All of the above
Hide Answer ⟵
d. All of the above
35. __________ are variables that can hold more than one value, they
can hold a list of values of the same type.
a. Loop
b. Constant
c. Variable
d. None of the above
Hide Answer ⟵
c. Variable
36. __________ helps to create a tab between the numbers in the print
statement.
a. \tt
b. \t
c. \tb
d. \tab
Hide Answer ⟵
b. \t
37. Array addresses always start from _________.
a. 0
b. 1
c. 2
d. 3
Hide Answer ⟵
a. 0
38. OOP Stands for ____________.
a. Object Oriented Programming
b. Outer Oriented Programming
c. Outer Object Programming
d. Oriented Object Programming
Hide Answer ⟵
a. Object Oriented Programming
39. Java’s most fundamental features are _________.
a. Class
b. Objects
c. Both a) and b)
d. None of the above
Hide Answer ⟵
c. Both a) and b)
40. Function declared inside the class is known as __________.
a. Member function
b. Inner function
c. Outer function
d. None of the above
Hide Answer ⟵
a. Member function
41. The body of class is enclosed within ____________.
a. Small braces
b. Curly braces
c. Big braces
d. None of the above
Hide Answer ⟵
b. Curly braces
42. The variable declared outside the class is known as ___________.
a. Local variable
b. Global variable
c. Inner variable
d. All of the above
Hide Answer ⟵
b. Global variable
43. The variable declared inside the class is known as __________.
a. Local variable
b. Global variable
c. Inner variable
d. All of the above
Hide Answer ⟵
a. Local variable
44. __________ is a data member that is declared but not initialized
before using, and is assigned a default value by the compiler, usually
either zero or null.
a. Class
b. Object
c. Constructors
d. None of the above
Hide Answer ⟵
c. Constructors
45. __________ has the same name as the class.
a. Class
b. Object
c. Constructors
d. None of the above
Hide Answer ⟵
c. Constructors
46. Data members and method members of an object are accessed using
the _________ operator.
a. Comma (,)
b. Dot (.)
c. Modular (%)
d. Dollar ($)
Hide Answer ⟵
b. Dot (.)
47. Data members of a class can be accessed from outside the class by
default. Identify the access modifiers from the below list __________.
a. Private
b. Public
c. Protected
d. All of the above
Hide Answer ⟵
d. All of the above
48. Private data members of a class cannot be accessed outside the
class however, you can give controlled access to data members outside
the class through ____________.
a. Getter
b. Setter
c. Both a) and b)
d. None of the above
Hide Answer ⟵
c. Both a) and b)
49. To import the class from the package, you have to use ____________
keyword.
a. Insert
b. Import
c. Add
d. None of the above
Hide Answer ⟵
b. Import
50. We can take input from the user using ___________ object.
a. Scanner
b. [Link]();
c. Both a) and b)
d. None of the above
Hide Answer ⟵
a. Scanner
51. _________ function helps to convert string value to the integer value
in Java.
a. parseInt();
b. parseDouble()
c. parseString();
d. None of the above
Hide Answer ⟵
a. parseInt();
52. To sort the array of integers in ascending order _______ function
required.
a. Arrange()
b. Filter()
c. Sort()
d. None of the above
Hide Answer ⟵
c. Sort()
53. __________ function helps to convert all of the characters in lower
case.
a. toLowerCase()
b. toSmallCase()
c. to BelowCase()
d. None of the above
Hide Answer ⟵
a. toLowerCase()
54. __________ function helps to convert all the characters in Upper
case.
a. toUpperCase()
b. toCaptialCase()
c. touppercase()
d. None of the above
Hide Answer ⟵
a. toUpperCase()
55. __________ function helps to return a new string after replacing all
occurrences of old string.
a. replace()
b. Change()
c. Convert()
d. None of the above
Hide Answer ⟵
a. replace()
56. ________ function helps to return the length of the string.
a. replace()
b. isEmpty()
c. indexOf()
d. None of the above
Hide Answer ⟵
a. replace()
57. _______ function helps to return the index of the first occurrence of a
given substring.
a. length()
b. isEmpty()
c. indexOf()
d. None of the above
Hide Answer ⟵
c. indexOf()
58. When unexpected errors come in the program it is handled by
___________.
a. Error handling
b. Exception handling
c. Both a) and b)
d. None of the above
Hide Answer ⟵
b. Exception handling
60. Which keywords handle an exception in Java programming.
a. Try
b. Catch
c. Both a) and b)
d. None of the above
Hide Answer ⟵
c. Both a) and b)
61. _________ helps to access the network services that are running on
the local computer.
a. Localhost
b. Local Network
c. network
d. None of the above
Hide Answer ⟵
a. Localhost
62. What are the different ways to create threads in Java?
a. By extending the Thread class
b. By implementing the Runnable interface
c. Both a) and b)
d. None of the above
Hide Answer ⟵
c. Both a) and b)
63. A ______________ is one that can perform multiple tasks
concurrently so that there is optimal utilization of
the computer’s resources.
a. Resources program
b. Multithreaded program
c. Class program
d. None of the above
Hide Answer ⟵
b. Multithreaded program
64. What are the different types of passing values in Java?
a. Pass by value & not Pass by reference
b. Pass by data & Pass by address
c. Pass by String & Pass by reference
d. None of the above
Hide Answer ⟵
a. Pass by value & not Pass by reference
65. What are the basic idea in exception handling ____________.
a. Denote an exception block
b. Catch the exception
c. Handle the exception
d. All of the above
Hide Answer ⟵
d. All of the above
66. ___________ a file format based on the popular ZIP file format and is
used for aggregating many files into one.
a. Java ARchive (JAR)
b. Java Bin (JB)
c. Java Method (JM)
d. None of the above
Hide Answer ⟵
a. Java ARchive (JAR)
67. JDBC Stands for ___________.
a. Java Data Connection
b. Java Database Connection
c. Java Database Connectivity
d. Java Data Connectivity
Hide Answer ⟵
c. Java Database Connectivity
68. An ___________ is a useful mechanism for effectively
identifying/detecting and correcting logical errors in a program. When
developing your Java programs.
a. Database
b. Assertion
c. Archive
d. None of the above
Hide Answer ⟵
b. Assertion
69. What is the output of the Java program?
int a=10;
if(a==9)
[Link](” My “);
[Link](“School”);
else
[Link](“My Class”);
a. My School
b. My Class
c. Compiler error
d. None of the above
Hide Answer ⟵
c. Compiler error
70. What is the output of the Java program?
String name1=”My School”, name2=”My Class”;
if(name1 == “My School”)
{
[Link](“My School “);
[Link](“My Class”);
}
if(name2 == “No Class”)
{
[Link](“My Class”);
}
a. My School My Class
b. My School My Class My Class
c. Compiler error
d. None of the above
Hide Answer ⟵
a. My School My Class
71. What is the output of the Java program?
String name=”Anurag”;
if(name == “Anand”)
{
[Link](“Anurag”);
}
[Link](“Computer Science”);
a. Anurag Computer Science
b. Anurag
c. Computer Science
d. Compiler error
Hide Answer ⟵
c. Computer Science
72. What is the output of the Java program with ELSE-IF statements?
int marks=90;
if(marks >= 80)
[Link](“Distinction”);
else if(marks >=33)
[Link](“Pass”);
else
[Link](“Fail”);
a. Distinction
b. Pass
c. Fail
d. Compiler error
Hide Answer ⟵
Computer Science skill enhancement classes
b. Pass
73. What is the output of Java program below?
float temp = 97.3;
if(temp > 97.3)
{
[Link](“High Temperature”);
}
else
{
[Link](“Temperature”);
}
a. High Temperature
b. Temperature
c. Compiler error
d. None of the above
Hide Answer ⟵
a. High Temperature
74. What is the output of the Java program?
int marks = 91;
if(marks > 32)
{
if(age <= 100)
{
[Link](“Pass”);
}
}
else
{
[Link](“Fail”);
}
a. Pass
b. Fail
c. Compiler error
d. None of the above
Hide Answer ⟵
a. Pass
75. What is the output of the Java program?
int marks=55;
if(marks > 55);
[Link](“Pass “);
[Link](“Fail”);
a. Fail
b. Pass
c. Pass Fail
d. Compiler error
Hide Answer ⟵
c. Pass Fail
76. What is the result of the IF statement in a Java programme?
if(true)
{
break;
[Link](“School”);
}
a. No Output
b. School
c. Compiler error
d. None of the above
Hide Answer ⟵
School vocational programs
c. Compiler error
77. Java is a ______ programming language.
a. Procedure Oriented
b. Object-Oriented
c. Practical
d. All of the above
Hide Answer ⟵
b. Object-Oriented
78. The code in the Java programming language is put inside
___________.
a. Blocks
b. Methods
c. Classes, Interfaces
d. All the above
Hide Answer ⟵
d. All of the above
79. What file extension is associated with the Java class source code?
a. .jpp
b. .jsp
c. .java
d. None of the above
Hide Answer ⟵
c. .java
80. What file extension is associated with compiled Java class files?
a. .jpp
b. .java
c. .class
d. .clear
Hide Answer ⟵
c. .class
81. In Java, the keyword used to declare a class is _________.
a. Function
b. Method
c. class
d. Java
Hide Answer ⟵
c. class
82. A Java class can contain___________.
a. Variables
b. Methods, Constructors
c. Inner Classes (A class inside another class)
d. All of the above
Hide Answer ⟵
d. All of the above
83. In Java, the word ________ is used to create a new object.
a. java
b. new
c. class
d. function
Hide Answer ⟵
b. new
84. In Java, an object is created at _________ time.
a. Assembling time
b. Run time
c. Compile-time
d. None of the above
Hide Answer ⟵
b. Run time
85. Select the appropriate Java class declaration syntax from the list
below.
a.
class CLASSNAME
{
}
b.
CLASSNAME class
{
}
c.
class CLASSNAME;
{
}
d.
Class CLASSNAME
{
Hide Answer ⟵
a. class CLASSNAME { }
86. Pick the appropriate method for producing an object of the class
listed below.
class Table
{
Table(){[Link](“Table Created”);}
}
a. Table t = new Table;
b. Table t = new Table();
c. Table() t = new Table();
d. None of the above
Hide Answer ⟵
b. Table t = new Table();
87. A control statement in Java is called a _________ SWITCH case
statement.
a. Iteration
b. Loop
c. Selection
d. Jump
Hide Answer ⟵
c. Selection
88. Which is the Java language equivalent of SWITCH?
a. break, continue
b. for, while
c. if, else
d. goto, exit
Hide Answer ⟵
c. if, else
42. What keywords are needed in Java to implement a SWITCH case?
a. switch, case
b. default
c. break
d. All of the above
Hide Answer ⟵
d. All of the above
89. Select the proper SWITCH statement syntax for Java from the list
below.
a.
switch(input)
{
case constant1: //statements; break;
case constant2: //statements; break;
default: //statements;
};
b.
switch(input)
{
case constant1: //statements; break;
case constant2: //statements; break;
default: //statements;
}
c.
switch(input)
{
case constant1: //statements; break;
case constant2: //statements; break;
default case: //statements;
};
d.
switch(input)
{
case constant1: //statements; break;
case constant2: //statements; break;
default case: //statements;
Hide Answer ⟵
}
b. switch(input) { case constant1: //statements; break; case constant2:
//statements; break; default: //statements; }
90. What is the result of the following Java application with SWITCH?
int a=10;
switch(a)
{
case 10: [Link](“Welcome”);
}
a. No output
b. Welcome
c. Compiler error as there is no BREAK.
d. None
Hide Answer ⟵
b. Welcome
91. What does the Java programme below produce?
String animal = “Horse”;
switch(animal)
{
break: [Link](“DOMESTIC”);
}
a. No output
b. Horse
c. DOMESTIC
d. Compiler error
Hide Answer ⟵
d. Compiler error