wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Week 1

Total questions: 50

Worksheet time: 41mins

Name
Class
Date
1.

Choose the correct definition of Java

a)
Java is a low-level, function-based, procedural programming language.
b)
Java is a high-level, class-based, object-oriented programming language.
c)

Java is an interpreted scripting language primarily used for styling web pages and adding interactivity to HTML documents.

d)

Java is a compiled, functional programming language primarily used for complex database queries and data manipulation.

2.

In Java, what does the acronym WORA stand for, and what does it mean in practice?

a)
Write Once, Run Anywhere
b)
Write Once, Test Anywhere
c)
Write Once, Compile Anywhere
d)
Write Once, Deploy Anywhere
3.

What is a high-level programming language?

a)

A language that is very close to machine code (0s and 1s)

b)

A language that focuses on hardware details and memory management

c)

A language that uses syntax close to human language and hides complex hardware details

d)

A language that can only run on one specific type of computer

4.

In Java, what does it mean when we say Java is a class-based programming language?

a)

All Java code must be written inside a class – a class serves as the blueprint for creating objects

b)

Java only supports classes and does not allow objects

c)

Java uses inheritance from multiple classes

d)

Programs are made of standalone functions without classes

5.

Which company originally developed Java, and in which year was it first publicly released?

a)
Sun Microsystems, 1995
b)
IBM, 1997
c)
Microsoft, 1994
d)
Oracle Corporation, 1996
6.

Who is known as the “Father of Java”?

a)
James Gosling
b)
Mark Zuckerberg
c)
Bill Gates
d)
Elon Musk
7.

What was the original name of the Java programming language before it was renamed “Java”?

a)
Pine
b)
Oak
c)
Tree
d)
Maple
8.

What is Java EE (Enterprise Edition) primarily used for?

a)
Java EE is mainly used for mobile app development.
b)
Java EE is focused on game development and entertainment.
c)
Java EE is primarily used for web design and graphics.
d)
Java EE is primarily used for developing enterprise applications.
9.

What is Java ME (Micro Edition) primarily used for?

a)
Building web applications for browsers.
b)
Designing high-performance server software.
c)

Developing applications for mobile and IoT devices

d)
Creating desktop applications for Windows.
10.

What is Java SE (Standard Edition) primarily used for?

a)

Developing general-purpose applications, including desktop applications, console programs, and as the foundation for all other Java editions

b)

Running Java on very small devices like old mobile phones

c)

Building large enterprise web applications and servers

d)

Creating Android mobile apps

11.

What is JavaFX primarily used for in Java?

a)
Developing mobile applications for Android.
b)
Building web applications with HTML and CSS.
c)
Building rich client applications with advanced user interfaces.
d)
Creating server-side applications with Java.
12.

Which of the following statements is most accurate about learning Java (or programming in general)?

a)

You need to learn advanced topics first before solving real problems

b)

Complex problems can usually be solved by mastering and correctly applying the basic concepts

c)

Only experienced programmers who know every Java library can solve difficult problems

d)

Basics are only useful for simple programs, not real-world applications

13.

What does JDK stand for and what is it used for in Java?

a)

Java Development Kit – a software package that contains tools needed to develop, compile, and run Java programs

b)

Java Design KitJava Deployment Kit – used only for installing Java on users’ computers

c)

Java Development Kernel – the core part of the operating system for Java

d)

Java Debugging Kit – only for finding errors in code

14.

To write and run Java programs, you need the JDK. Why?

a)

It only lets you run programs (like JRE)

b)

It contains the compiler and tools to develop Java applications

c)

It is only for advanced enterprise applications

d)

It is the same as the Java Virtual Machine

15.

What does JRE stand for and what is its purpose in Java?

a)

Java Runtime Environment – provides the libraries and JVM to run Java programs

b)

Java Resource Editor – used to edit Java source code

c)

Java Runtime Engine – only compiles Java code

d)

Java Repository Environment – stores Java libraries

16.

What is the JVM in Java?

a)

A tool used to write and edit Java source code

b)

The Java Virtual Machine – it runs Java bytecode and makes Java platform-independent

c)

A software package that contains the compiler (javac)

d)

A library for building web applications

17.

What is a variable in Java (or programming)?

a)

A fixed value like 5 or "hello" that cannot change

b)

A named storage location in memory that can hold a value and whose value can change during the program

c)

A keyword used to create objects

d)

A type of loop

18.

How many types of variables are there in Java, and what are they?

a)

2 types: global and local

b)

3 types: local, instance, and static variables

c)

4 types: int, float, char, and boolean

d)

3 types: public, private, and protected

19.

In Java, what does the syntax dataType variableName = value; represent?

a)

A method declaration

b)

A class definition

c)

A variable declaration and initialization

d)

A loop statement

20.

Choose the correct variable declaration and initialization in Java:

a)

int = number 10;

b)

variable int number = 10;

c)

int number = 10;

d)

number int = 10;

21.

A variable in Java must have a data type.

a)
False
b)
True
22.

A variable name can start with a number.

a)
True
b)
False
23.

Variable names can start with a letter, underscore, or dollar sign.

a)
Variable names can start with a letter, underscore, or dollar sign.
b)
Variable names can only start with a number or letter.
24.

Variable names can contain spaces.

a)
False
b)
True
25.

Variable names in Java are case-sensitive.

a)
False
b)
True
26.

A variable must be initialized before it is used.

a)
False
b)
True
27.

Variable names cannot contain special characters except _ and $.

a)
Variable names can include any special characters.
b)
Variable names can only contain letters, digits, _ and $.
28.

Using camelCase for variable names is recommended in Java.

a)
True
b)
False
29.

Which of the following examples correctly demonstrates the programming naming convention known as PascalCase?

a)

is_authenticated_user

b)

calculateTotalAmount

c)

CustomerOrderDetails

d)

database-connection-string

30.

The programming term isEnrolled follows which of the following naming conventions?

a)

camelCase

b)

PascalCase

c)

snake_case

d)

kebab-case

31.

What is the naming convention for the variable name user_account_id?

a)
kebab-case
b)
PascalCase
c)
snake_case
d)
camelCase
32.

Identify the naming convention for the class name ProductDetailView.

a)
kebab-case
b)
PascalCase
c)
snake_case
d)
camelCase
33.

Which naming convention is used for the file name about-us-page.html?

a)
camelCase
b)
PascalCase
c)
kebab-case
d)
snake_case
34.

The method name processUserInput is an example of which convention?

a)
kebab-case
b)
camelCase
c)
snake_case
d)
PascalCase
35.

Which naming convention is most commonly used for constants in languages like C++ and Java (e.g., MAX_ITERATIONS)?

a)
UPPER_SNAKE_CASE
b)
kebab-case
c)
PascalCase
d)
lower_snake_case
36.

Which of these variable names is written in PascalCase?

a)

DatabaseConnection

b)

validateAccount

c)

is_data_ready

d)

get_user_info

37.

What is the primary difference between PascalCase and camelCase?

a)
PascalCase is used for variables, camelCase for classes.
b)
PascalCase uses underscores, camelCase does not.
c)
PascalCase is for functions, camelCase is for constants.
d)
PascalCase starts with an uppercase letter, camelCase starts with a lowercase letter.
38.

The URL slug /products/best-selling-items uses which naming convention?

a)
snake_case
b)
PascalCase
c)
camelCase
d)
kebab-case
39.

A Boolean variable named hasPermissions is an example of which convention, and what does the prefix has suggest?

a)

kebab-case; it suggests the variable stores a large object.

b)

camelCase; it suggests the variable stores a true or false value.

c)

PascalCase; it suggests the variable stores a number.

d)

snake_case; it suggests the variable stores a string.

40.

What is a data type in java

a)
A data type in Java is a method for executing code in a program.
b)
A data type in Java is a classification that specifies which type of value a variable can hold.
c)
A data type in Java is a way to define the structure of a class.
d)
A data type in Java is a tool for managing memory allocation in applications.
41.

Data types are divided into two groups:

a)
Integer and float data types
b)
Static and dynamic data types
c)
Simple and complex data types
d)

Primitive and reference data types

42.

How many primitive types are there in Java?

a)
8
b)
4
c)
10
d)
6
43.

What is the default data type when declaring a whole number in Java?

a)
int
b)
float
c)
byte
d)
double
44.

What is the default value of when you declare a whole number in Java?

a)
0
b)
-1
c)
10
d)
1
45.

What is the default data type when declaring a floating point number in Java?

a)
int
b)
decimal
c)
double
d)
float
46.

What is the default value of when you declare a floating point number in Java?

a)
null
b)
-0.0
c)
0.0
d)
1.0
47.

What is the default value of when you declare a Boolean in Java?

a)
true
b)
false
c)
null
d)
undefined
48.

A high-level, class-based, object-oriented programming language designed to have as few implementation dependencies as possible.

a)

Java

b)

JavaScript

c)

JavaRice

d)

Java Coffee

49.

What is the error in the following Java statement?

a)
The statement is missing a semicolon.
b)

There is no error — all declarations are correct

c)

Variable names cannot start with a number — 123count is invalid

d)

The keyword int should be written as Integer

50.

Which line has a syntax error when declaring or initializing a variable?

a)

int age = 15

b)

double height = 1.75;

c)

boolean isStudent = true;

d)

char grade = 'B';