Exam 4: Defining Classes I

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

A _________ states what is assumed to be true when the method is called.

Free
(Multiple Choice)
4.7/5
(30)
Correct Answer:
Verified

C

Define the terms arguments and parameters.How are they different?

Free
(Essay)
4.9/5
(33)
Correct Answer:
Verified

Parameters,also referred to as formal parameters,are used to define the list of variables included in the parenthesis in a method signature.An argument is the value actually sent to the method upon invocation.The terms parameters and argument are very similar in meaning and are often used interchangeably by programmers.The terms differ slightly in that an argument is the actual value that replaces the parameter within the method.

When you give a command to run a Java program,the runtime system invokes the class constructor.

Free
(True/False)
4.8/5
(39)
Correct Answer:
Verified

False

In Java,call-by-value is only used with:

(Multiple Choice)
4.8/5
(40)

Discuss a situation in which it is appropriate to use the this parameter.

(Essay)
4.8/5
(42)

Discuss the importance of accessor and mutator methods and how they apply to the abstraction concept.

(Essay)
4.8/5
(41)

Mutator methods can return integer values indicating if the change of the instance variable was a success.

(True/False)
4.8/5
(45)

Accessor methods:

(Multiple Choice)
4.9/5
(44)

A set method is:

(Multiple Choice)
4.8/5
(39)

An invocation of a method that returns a value can be used as an expression any place that a value of the Type_Returned can be used.

(True/False)
4.8/5
(25)

A program whose only task is to test a method is called a:

(Multiple Choice)
4.9/5
(35)

Two methods that are expected to be in all Java classes are:

(Multiple Choice)
4.8/5
(42)

Discuss the public and private modifiers in context of methods and instance variables.

(Essay)
4.9/5
(39)

Only the default constructor has the this parameter.

(True/False)
4.7/5
(31)

The body of a method that returns a value must contain at least one _________ statement.

(Multiple Choice)
4.8/5
(39)

In Java,a block is delimited by:

(Multiple Choice)
4.8/5
(37)

Write preconditions and postconditions for the power method you wrote in question #4.

(Essay)
4.8/5
(38)

Add two constructors to the Appointment class created in question #9.Include a default constructor and a constructor to initialize an Appointment to suitable arguments.

(Essay)
4.9/5
(28)

Write a Java class that represents a Student with instance variables name,id,and gpa.Include constructors,accessor,mutator and any facilitator methods you may need.

(Essay)
5.0/5
(40)

Create a class named Appointment that contains instance variables startTime,endTime,dayOfWeek valid values are Sunday through Saturday),and a date which consists of a month,day and year.All times should be in military time,therefore it is appropriate to use integers to represent the time.Create the appropriate accessor and mutator methods.

(Essay)
4.8/5
(37)
Showing 1 - 20 of 45
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)