What is the correct way to declare a variable int named "Name"?
int Name;
How do you write a single-line comment in Java?
//
What is a nested if statement?
An if statement inside another if statement.
What is an array in Java?
Used to store multiple values in a single variable.
Write a simple Java statement that outputs "Hello, World!" to the console.
System.out.println("Hello, World!");
System.out.print("Hello, World!");
What is the syntax for a multi-line comment in Java?
/* comment */
what type of loop statement is used to iterate a block of code a specific number of times.
For loop
How do you declare a two-dimensional int array in Java named ''arr''?
int[][] arr;
How do you end a statement in Java?
With a semicolon (;)
Why are comments used in programming?
To explain code and make it more understandable. For Labeling
Write the syntax for a while loop in Java.
while (condition) {
// code
}
How would you access the element at the second row and third column of a 2D array named ''arr''?
arr[1][2]
What do you use to print output to the console in Java?
System.out.println();
Can comments affect the execution of Java code?
No, comments are ignored by the compiler.
What is the key difference between a do-while loop and a while loop?
A do-while loop guarantees to run at least once.
What is the syntax for declaring a three-dimensional array in Java named ''matrix''?
int[][][] matrix;
What is the structure of a basic Java if statement?
if (condition) {
// code
}
Can you disable a block of code using comments?
Yes, by using multi-line comments.
Explain the purpose of the break statement in loops.
To exit the loop immediately, regardless of the loop condition.
What keyword are you going to use to find the number of elements in an array?
.length