Computer Science Exam 2 Review

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Which statement is true about inheritance?

A class can serve as a base class for multiple derived classes.

Given the list (75, 76, 68), identify the commands for the following operations. Insert item 80 at the end of the list Remove item 68 Insert item 82 at the end of the list Get the total number of items in the list

Append(list, 80) Remove(list, 68) Append(list, 82) GetLength(list)

Which XXX completes the code?

SoccerPlayers newPlayers;

Given the array-based list (20, 30, 40, 50), what will the new array look like after the following operations? ArrayListPrepend(list, 10) ArrayListSearch(list, 25) ArrayListRemoveAt(list, 3) ArrayListSearch(list, 40)

10, 20, 30, 50

What is the ending value of the integer variable myInt?

30

When adding an item to an array-based list with an allocation size equal to the list length, a new array is generally allocated with _____ the current length.

twice

When a class derives the properties of the base class, the concept is called _____.

inheritance

Which of the following statements is true about destructors?

Destructors are used to deallocate the memory that has been allocated for the object.

Identify the commands for the following list operations. Check that there are no items in a list Insert 10, 50, 30, 40, and 20 at the end of the list Arrange the items in ascending order

IsEmpty(list) Append(list, 10) Append(list, 50) Append(list, 30) Append(list, 40) Append(list, 20) Sort(list)

Which statement correctly declares a copy assignment operator for a class named PatientDetails using inVal as the input parameter name?

PatientDetails& operator = (const PatientDetails& inVal);

For a class SampleCopy, identify the incorrect way to call a copy constructors to copy object1 to object2.

SampleCopy object2(&object1);

Which members of the base class Players are inherited by the class SoccerPlayers?

SetName, SetAge, PrintDetails, pName, and pAge

Which of the following is not true for default assignment operator for objects with pointer data members?

The default assignment operator works on objects with pointer members.

Consider a class Student. The following code is used to create objects and access its member functions. Which statement is true about the code?

There are three objects created of Student class and they each have their own memory locations. The GetDetails() function is invoked for only the stud object of the class Student.

Given the following class definition in the file ClassRoom.h, which XXX and YYY complete the corresponding .cpp file?

XXX: #include "ClassRoom.h" YYY: void ClassRoom::Print()

The new operator _____.

allocates memory after calling the class's constructor

Which XXX completes the following algorithm for inserting a new node into a singly-linked list?

newNode⇢next = curNode⇢next curNode⇢next = newNode

What is the return type for constructors?

none

What line of code assigns a char variable outputGames with the value the gamesPointer points to?

outputGames = *gamesPointer;

Declaring a member as ____ in the base class provides access to that member in the derived classes but not to anyone else.

protected

In the following UML class diagram, + calculateScore(): int depicts a ___

public method which returns an int value

In the following code, which statement can replace Statement 1?

sample1->show_data();

Which statement will throw an error in the following code?

stu1.Grade();

A pointer is a(n) _____ that contains a _____.

variable, memory address

Which of the following is the LinkedList class destructor?

~LinkedList();


संबंधित स्टडी सेट्स

Unit 14 Determine the Value of a Collection of Coins and Bills

View Set

Marketing Research Exam 2 Practice Problems

View Set