Code Structure & Syntax QuizS2C Home « Code Structure & Syntax Quiz

Fundamentals Quiz 1

The quiz below tests your knowledge of the material learnt in Fundamentals - Lesson 2 - Code Structure & Syntax.

Question 1 : Which of the following goes inside a class definition?
- Methods go inside a class definition.
Question 2 : We use the java command to compile programs in Java?
- We use the javac command to compile programs.
Question 3 : What does the void keyword specify?
- The void keyword specifies that nothing is returned from the method.
Question 4 : How do we run a file called Hello.class that contains a main() method?
- We run a file called Hello.class using java Hello.
Question 5 : Who has access to a public class?
- A public class can be accessed by anyone.
Question 6 : How do we compile a file called Hello.java?
- We compile a file called Hello.java using javac Hello.java
Question 7 : A statement contains methods?
- A method contains statements.
Question 8 : A source file should be named after its class?
- A source file should be named after it's class. In fact if the class is public and you name the source file differently and try to compile it you get an error.
Quiz Progress Bar Please select an answer


What's Next?

The next quiz is all about the variables we use in Java.