WorksheetsJava MCQs – Introduction, Variables, and Data Types
Total questions: 20
Worksheet time: 10mins
Java was originally developed by:
Microsoft
Apple
Sun Microsystems
IBM
Which principle makes Java platform-independent?
Object-Oriented
Robust
Write Once, Run Anywhere
Secure
Which component converts Java source code into bytecode?
JVM
JRE
JIT
Compiler (javac)
Which method is the entry point of a Java program?
start()
main()
run()
execute()
Which keyword is used to define a class in Java?
define
class
struct
object
A variable declared inside a method is called:
Instance variable
Static variable
Local variable
Global variable
Which keyword is used to declare a static variable?
final
public
static
private
Which of the following is a valid variable name in Java?
1number
total marks
class
_count
Which data type is used to store whole numbers by default?
byte
short
int
long
Size of int data type in Java is:
2 bytes
4 bytes
8 bytes
1 byte
Which data type is used to store true or false values?
boolean
char
int
float
Which symbol is used to store single characters?
" "
{ }
' '
[ ]
Which data type requires suffix 'f' while assigning value?
double
long
float
int
Which of the following is NOT a primitive data type?
int
float
String
char
Which non-primitive data type is used to store text?
char
String
boolean
int
Which data type stores memory address of an object?
Primitive
Non-Primitive
boolean
char
Which of the following can store multiple values of same type?
Variable
Method
Array
Class
Which feature of Java handles runtime errors?
Inheritance
Compilation
Exception Handling
Polymorphism
Which of the following is TRUE about primitive data types?
They store object references
They are slower
They can be null
They store actual values
Which JVM component improves performance?
Compiler
Interpreter
JIT Compiler
Loader
