Font size
WorksheetsGrade 11 - IT - Quiz 1 - Mrs. Dina Mohamed
Total questions: 23
Worksheet time: 17mins
What is Java primarily used for?
Designing graphics
Creating video games
Writing system software
Developing mobile apps
What does platform independence in Java mean?
Java programs can run on any device with a JVM
Java can only run on Windows
Java requires specific hardware
Java is only for mobile devices
What symbol is used to end a statement in Java?
,
:
;
.
Which of the following is a keyword in Java?
function
className
variable
int
What is the entry point of a Java program?
main()
execute()
start()
run()
What does the System.out.println() method do?
Creates a new class
Reads input from the user
Prints text to the console
Declares a variable
Which data type is used to store whole numbers in Java?
String
char
int
float
What is the output of the following code: System.out.println("The sum is: " + (10 + 20));?
The sum is: 30
The sum is: 10
The sum is: 10 + 20
The sum is: 20
What type of comment is represented by // ?
Multi-line comment
Single-line comment
Block comment
Documentation comment
What is the purpose of the main() method in Java?
To print output
To declare variables
To execute the program
To define a class
What will be the output of the following code: System.out.println("Hello, World!");?
World, Hello!
Hello, World
Hello World!
Hello, World!
Which of the following is a valid way to declare a character variable?
char grade = 'A';
char grade = "A";
char grade = A;
What does the '+' operator do in Java?
Concatenates strings
Adds two numbers
Both adds and concatenates
Subtracts two numbers
Java is short for "JavaScript".
true
false
How do you create a variable with the numeric value 5?
float x = 5;
x = 5;
int x = 5;
num x = 5
Which operator is used to add together two values?
The + sign
The * sign
The & sign
what is the output?
System.out.println("10" + 15);
25
1015
"10"15
Errors/Warnings
What will be the output of this code?
class Codechef {
public static void main(String[] args) {
int a = 10, b = 3 ;
System.out.print("a / b");
} }
3.333
3
4
a / b
What will be the output of this code?
class Codechef {
public static void main(String[] args) {
int a = 10 ;
int b = 2 ;
int c = a / b;
System.out.print(c); } }
3.333
5
4
a / b
14. What will be the output of this code? class Codechef {
public static void main(String[] args) {
System.out.print("Add2 ");
System.out.print("");
System.out.print("to3"); } }
Add2to3
Add 2 to 3
Add2 to3
Add2to 3
What will be the output of this code?
class Codechef {
public static void main(String[] args) {
System.out.println(82);
System.out.print(2);
System.out.print(" 3");
} }
82
2 3
82
23
822 3
822" "3
Which line of code will output the sum of 7 and 19?
System.out.print(7 + 19);
System.out.print("7 + 19");
system.out.print(7 + 19);
System.out.print(7 + 19)
Which line of code will output the string "Hi"?
Sys.out.print("Hi");
System.out.print("Hi");
System.out.print(Hi);
System.out.print("Hi")
