Basic Java Syntax
Comments
Nested Loops
Arrays
1

What is the correct way to declare a variable int named "Name"?

int Name;

1

How do you write a single-line comment in Java?

//

1

What is a nested if statement?

An if statement inside another if statement.

1

What is an array in Java?

Used to store multiple values in a single variable. 

2

Write a simple Java statement that outputs "Hello, World!" to the console.

System.out.println("Hello, World!");

System.out.print("Hello, World!"); 

2

What is the syntax for a multi-line comment in Java?

/* comment */

2

what type of loop statement is used to iterate a block of code a specific number of times.

For loop

2

How do you declare a two-dimensional int array in Java named ''arr''?

int[][] arr;

3

How do you end a statement in Java?

With a semicolon (;)

3

Why are comments used in programming?

To explain code and make it more understandable. For Labeling

3

Write the syntax for a while loop in Java.

while (condition) {   

 // code 

}

3

How would you access the element at the second row and third column of a 2D array named ''arr''?

arr[1][2]

4

What do you use to print output to the console in Java?

System.out.println();

4

Can comments affect the execution of Java code?

No, comments are ignored by the compiler.

4

What is the key difference between a do-while loop and a while loop?

A do-while loop guarantees to run at least once.

4

What is the syntax for declaring a three-dimensional array in Java named ''matrix''?

int[][][] matrix;

5

What is the structure of a basic Java if statement?

if (condition) {   

 // code

}

5

Can you disable a block of code using comments?

Yes, by using multi-line comments.

5

Explain the purpose of the break statement in loops.

To exit the loop immediately, regardless of the loop condition.

5

What keyword are you going to use to find the number of elements in an array?

.length