Understanding GradeBook Program in Java
18 Questions
1 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

The GradeBook constructor is used to specify the course name at the time each GradeBook object is created.

True

In the GradeBookTest class, 'gradeBook1' was created with the course name 'CS102 Data Structures in Java'.

False

The displayMessage method in the GradeBook class will print a welcome message with the course name.

True

In GradeBookTest main method, gradeBook2's course name is displayed before gradeBook1's course name.

<p>False</p> Signup and view all the answers

The GradeBookTest class contains the main method that begins the program execution.

<p>True</p> Signup and view all the answers

The GradeBook class does not have a method to retrieve the course name.

<p>False</p> Signup and view all the answers

In the Java program, the initial value of the course name is null.

<p>True</p> Signup and view all the answers

The GradeBook object is created using the 'new' keyword in the program.

<p>True</p> Signup and view all the answers

The program prompts the user to enter the course name using a Scanner object.

<p>True</p> Signup and view all the answers

The setCourseName method is used to set the course name in the GradeBook object.

<p>True</p> Signup and view all the answers

The displayMessage method is called after setting the course name.

<p>True</p> Signup and view all the answers

The program imports a package named 'java.util.Scanner'.

<p>False</p> Signup and view all the answers

In the GradeBook class, the courseName instance variable is declared as 'private'.

<p>True</p> Signup and view all the answers

The method 'setCourseName' in the GradeBook class returns a value of type 'String'.

<p>False</p> Signup and view all the answers

The 'displayMessage' method in the GradeBook class calls the 'getCourseName' method to get the name of the course.

<p>True</p> Signup and view all the answers

In GradeBook.java, 'public' keyword is used for most instance variables.

<p>False</p> Signup and view all the answers

Encapsulation is achieved by declaring instance variables in the GradeBook class as public.

<p>False</p> Signup and view all the answers

The return type in a method declaration indicates the item passed to that method.

<p>False</p> Signup and view all the answers

More Like This

Use Quizgecko on...
Browser
Browser