Exam 3: Using Methods, Classes, and Objects

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

Any class can contain an unlimited number of methods.

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

True

How do you create an instance of a class? Provide an example.

Free
(Essay)
4.8/5
(30)
Correct Answer:
Verified

A two-step process creates an object that is an instance of a class. First, you supply a type and an identifier-just as when you declare any variable-and then you allocate computer memory for that object. For example, you might define an integer as int someValue; and you might define an Employee as follows: Employee someEmployee;. In this statement, someEmployee stands for any legal identifier you choose to represent an Employee.

Explain the purpose of a return type of a method. Describe the return value of a method that returns no data.

Free
(Essay)
4.8/5
(46)
Correct Answer:
Verified

A return type describes the type of data the method sends back to its calling method. Not all methods return a value to their calling methods; a method that returns no data has a return type of void.

A(n) ____________________ is a number appended to a field, typically an ID number or account number.

(Short Answer)
4.9/5
(39)

Methods used with object instantiations are called ____ methods.

(Multiple Choice)
4.9/5
(30)

Match each term with the correct statement below. -Used to return a value back to the calling method

(Multiple Choice)
4.9/5
(34)

Does a programmer need to write every class he or she uses? Why or why not?

(Essay)
4.8/5
(47)

You are ____ required to write a constructor method for a class.

(Multiple Choice)
4.8/5
(38)

A(n) ____ is a program module that contains a series of statements that carry out a task.

(Multiple Choice)
4.9/5
(32)

A(n) ____ causes a value to be sent from a called method back to the calling method.

(Multiple Choice)
4.8/5
(38)

public int getStudentNum() { return studentNum; } In the above code, identify if the method is a mutator method or an accessor method. Describe how the two types of methods differ and how they are similar.

(Essay)
4.8/5
(29)

An object is a ____ of a class.

(Multiple Choice)
4.8/5
(36)

Methods use memory locations to hold values of variables. Describe the process of memory allocation and variable scope.

(Essay)
4.8/5
(35)

____ parameters are variables in a method declaration that accept the values from the actual parameters.

(Multiple Choice)
4.8/5
(37)

Parentheses - may contain data to be sent to the method, but may be empty if no outside data is required

(Essay)
4.9/5
(42)

To execute a method, you ____________________ it from another method.

(Short Answer)
4.7/5
(40)

When the parentheses of a method are empty, what does this indicate?

(Essay)
4.8/5
(45)

For ease in locating class methods, many programmers store them in ____ order.

(Multiple Choice)
4.9/5
(39)

Public classes are accessible by all objects, which means that public classes can be ____, or used as a basis for any other class.

(Multiple Choice)
4.9/5
(39)

____ is the encapsulation of method details within a class.

(Multiple Choice)
4.9/5
(37)
Showing 1 - 20 of 68
close modal

Filters

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