Examining Java's Syntax Flashcards

1
Q

What does the syntax of a programming language refer to?

a) The meaning of the program
b) The sequence of characters in a language
c) The rules and structure of the language
d) The output of the program

A

c) The rules and structure of the language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What happens if the System.out.println command is removed from the Java program?

public class MyFirstProgram {
public static void main(String[] args) {
System.out.println(“My first Java program!”);
}
}

a) The program will not compile
b) The program will compile but do nothing
c) The program will print an error message
d) The program will crash

A

b) The program will compile but do nothing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the purpose of the ‘Clear All’ button in IntelliJ’s console?

a) To delete all code in the editor
b) To reset IntelliJ settings
c) To clear the console output
d) To restart the Java program

A

c) To clear the console output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What happens if the name of the class does not match the name of the source file in Java?

a) The program will still run
b) The program will output an error
c) The IDE will ignore the mismatch
d) The program will execute successfully

A

b) The program will output an error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does IntelliJ do when you hover over a line with a syntax error?

a) It ignores the error
b) It highlights the error in blue
c) It provides a message explaining the error
d) It automatically fixes the error

A

c) It provides a message explaining the error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What should be done if the name of a public class does not match its source file?

a) Ignore the error
b) Change the class name to match the source file
c) Run the program as it is
d) Remove the public keyword

A

b) Change the class name to match the source file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What happens when you run a program in IntelliJ that has no main class?

a) The program runs successfully
b) The program prints ‘No main method found’
c) IntelliJ shows an error message
d) The program crashes

A

c) IntelliJ shows an error message

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the System.out.println() command do when parentheses are empty?

a) Prints an error message
b) Prints an empty line
c) Prints null
d) Prints a blank space

A

b) Prints an empty line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What happens when Java cannot find a reference class?

a) The program runs successfully with warnings
b) It issues a ‘Class Not Found Exception’
c) It ignores the missing class and continues
d) It prints a message about an undefined variable

A

b) It issues a ‘Class Not Found Exception’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the purpose of modifying a run configuration in IntelliJ?

a) To change the theme of the editor
b) To make the program compile faster
c) To point to the correct main class for execution
d) To automatically fix code syntax errors

A

c) To point to the correct main class for execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the red X next to a run configuration indicate in IntelliJ?

a) The code contains an infinite loop
b) The class specified in the run configuration cannot be found
c) The Java SDK version is incorrect
d) The console output has been cleared

A

b) The class specified in the run configuration cannot be found

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does renaming both the class and the source file to the same name accomplish?

a) It fixes compilation errors related to the file name
b) It changes the accessibility of the class
c) It runs the program without a main method
d) It allows you to bypass run configurations

A

a) It fixes compilation errors related to the file name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly