Object-Oriented Programming Review Questions - 949 Verified Questions

Page 1


Object-Oriented Programming Review Questions

Course Introduction

Object-Oriented Programming introduces students to the fundamental principles and concepts of object-oriented design and development. The course covers key topics such as classes, objects, inheritance, encapsulation, polymorphism, and abstraction, enabling students to model real-world problems and design robust, maintainable programs. Emphasizing hands-on practice, students learn to implement and test object-oriented solutions using popular programming languages, fostering critical problem-solving and software engineering skills applicable to modern application development.

Recommended Textbook

Starting Out with C++ from Control Structures to Objects 9th Edition by Tony Gaddis

Available Study Resources on Quizplus

21 Chapters

949 Verified Questions

949 Flashcards

Source URL: https://quizplus.com/study-set/1368 Page 2

Chapter 1: Introduction to Computers and Programming

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

Source URL: https://quizplus.com/quiz/27271

Sample Questions

Q1) A set of well-defined steps for performing a task or solving a problem is known as a(n):

A) hierarchy chart

B) algorithm

C) instruction set

D) statement

E) None of these

Answer: B

Q2) This is used in a program to mark the beginning or ending of a statement, or separate items in a list:

A) separators

B) punctuation

C) operators

D) key words

E) None of these

Answer: B

Q3) In C++, key words are written in all lowercase letters.

A)True

B)False

Answer: True

To view all questions and flashcards with answers, click on the resource link above. Page 3

Chapter 2: Introduction to C

Available Study Resources on Quizplus for this Chatper

62 Verified Questions

62 Flashcards

Source URL: https://quizplus.com/quiz/27272

Sample Questions

Q1) In the following statement, the characters Hello! are a(n) cout << "Hello!";

A) variable

B) string literal

C) comment

D) object

E) None of these

Answer: B

Q2) For every opening brace ({) in a C++ program, there must be a

A) string literal

B) function

C) comment

D) closing brace

E) None of these

Answer: D

Q3) A named constant is like a variable, but it its content cannot be changed while the program is running.

A)True

B)False

Answer: True

To view all questions and flashcards with answers, click on the resource link above.

Page 4

Chapter 3: Expressions and Interactivity

Available Study Resources on Quizplus for this Chatper

45 Verified Questions

45 Flashcards

Source URL: https://quizplus.com/quiz/27273

Sample Questions

Q1) When the fixed manipulator is used, the value specified by the setprecision manipulator will be the number of digits to appear after the decimal point.

A)True

B)False

Answer: True

Q2) To use the rand()function, you must include the __________ header file?

A) cstdlib

B) cstring

C) iostream

D) cmath

E) iomanip

Answer: A

Q3) The cin << statement will stop reading input when it encounters a newline character. A)True

B)False

Answer: True

To view all questions and flashcards with answers, click on the resource link above. Page 5

Chapter 4: Making Decisions

Available Study Resources on Quizplus for this Chatper

51 Verified Questions

51 Flashcards

Source URL: https://quizplus.com/quiz/27274

Sample Questions

Q1) This operator represents the logical AND:

A) ++

B) ||

C) &&

D) @

E) None of these

Q2) When an if statement is placed within the conditionally-executed code of another if statement, this is known as

A) complexity

B) overloading

C) nesting

D) validation

E) None of these

Q3) When a program lets the user know that an invalid choice has been made, this is known as:

A) input validation

B) output correction

C) compiler criticism

D) output validation

E) None of these

To view all questions and flashcards with answers, click on the resource link above. Page 6

Chapter 5: Loops and Files

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/27275

Sample Questions

Q1) What will the following code display?

Int number = 6;

Int x = 0;

X = --number;

Cout << x << endl;

A) 6

B) 5

C) 7

D) 0

Q2) What will the following code display?

Int x = 0;

For (int count = 0; count < 3; count++)

X += count;

Cout << x << endl; A) 0

B) 0

C) 6

D) 3

To view all questions and flashcards with answers, click on the resource link above.

Page 7

Chapter 6: Functions

Available Study Resources on Quizplus for this Chatper

49 Verified Questions

49 Flashcards

Source URL: https://quizplus.com/quiz/27276

Sample Questions

Q1) A _________ variable is declared outside all functions.

A) local

B) global

C) floating-point

D) counter

E) None of these

Q2) A collection of statements that performs a specific task is a(n)

A) infinite loop

B) variable

C) constant

D) function

E) decision

Q3) What is the data type of the following function prototype's parameter variable?

Int myFunction(double);

A) int

B) double

C) void

D) cannot tell from the prototype

To view all questions and flashcards with answers, click on the resource link above. Page 8

Chapter 7: Arrays and Vectors

Available Study Resources on Quizplus for this Chatper

56 Verified Questions

56 Flashcards

Source URL: https://quizplus.com/quiz/27277

Sample Questions

Q1) An array of string objects that will hold five names would be declared with which of the following statements?

A) string names[5];

B) string names(5);

C) string names 5;

D) String[5] = names;

Q2) Given the following declaration, where is the value 77 stored in the scores array?

Int scores[] = {83, 62, 77, 97, 86}

A) scores[0]

B) scores[1]

C) scores[2]

D) scores[3]

E) scores[5]

Q3) When you pass an array as an argument to a function, the function can modify the contents of the array.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above.

9

Chapter 8: Searching and Sorting Arrays

Available Study Resources on Quizplus for this Chatper

30 Verified Questions

30 Flashcards

Source URL: https://quizplus.com/quiz/27278

Sample Questions

Q1) Using a linear search to find a value that is stored in the last element of an array that contains 20,000 elements, __________ elements must be compared.

A) 20,000

B) only the first two

C) only half

D) 2,000

E) None of these

Q2) On average, an item is just as likely to be found near the beginning of an array as near the end.

A)True

B)False

Q3) The __________ sort usually performs fewer exchanges than the __________ sort.

A) bubble, selection

B) binary, linear

C) selection, bubble

D) ANSI, ASCII

E) None of these

To view all questions and flashcards with answers, click on the resource link above.

Chapter 9: Pointers

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

Source URL: https://quizplus.com/quiz/27279

Sample Questions

Q1) C++ does not perform array bounds checking, making it possible for you to assign a pointer the address of an element out of the boundaries of an array. A)True B)False

Q2) In C++11 you can use smart pointers to dynamically allocate memory and not worry about deleting the memory when you are finished using it.

A)True B)False

Q3) To use any of the smart pointers in C++11 you must use the following directive in the header file: #include &lt;memory&gt; A)True

B)False

Q4) The following statement __________ cin >> *num3;

A) stores the keyboard input in the variable num3

B) stores the keyboard input into the pointer num3

C) is illegal in C++

D) stores the keyboard input into the variable pointed to by num3

E) None of these

To view all questions and flashcards with answers, click on the resource link above. Page 11

Chapter 10: Characters, C-Strings, and More About the String Class

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

Source URL: https://quizplus.com/quiz/27280

Sample Questions

Q1) What is the result after the following statement executes? Char var1 = tolower('A');

A) var1 stores the character value 'A'

B) var1 stores the ASCII value for lowercase 'a'

C) the character A is output to the monitor

D) the character a is output to the monitor

E) None of these

Q2) The expression being tested by the statement shown below will evaluate to true if var1 is __________. if (!isdigit(var1))

A) an alphabetic character

B) 9

C) a symbol such as $ or &

D) both A and C

E) None of these

Q3) The string class's front and back member functions were introduced in C++11.

A)True

B)False

Q4) The ftoa function converts a floating-point value to an ASCII value.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 12

Chapter 11: Structured Data

Available Study Resources on Quizplus for this Chatper

46 Verified Questions

46 Flashcards

Source URL: https://quizplus.com/quiz/27281

Sample Questions

Q1) When a structure is passed __________ to a function, its members are not copied.

A) by reference

B) by value

C) Either of these

D) Neither of these

Q2) Given the following structure decaration, idNum is struct Employee {

String name;

Int idNum; };

A) a member

B) an array

C) a tag

D) None of these

Q3) Any mathematical operation that can be performed on regular C++ variables can be performed on structure members.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above.

Page 13

Chapter 12: Advanced File Operations

Available Study Resources on Quizplus for this Chatper

38 Verified Questions

38 Flashcards

Source URL: https://quizplus.com/quiz/27282

Sample Questions

Q1) When you store data in a variable, it is automatically saved in a file.

A)True

B)False

Q2) In order, the three-step process of using a file in a C++ program involves

A) insert a disk, open the file, remove the disk

B) create the file contents, close the file, name the file

C) open the file, read/write/save data, close the file

D) name the file, open the file, delete the file

E) None of these

Q3) Data stored __________ disappears once the program stops running or the computer is powered down.

A) on a CD

B) in RAM

C) on a flash drive

D) on the disk drive

E) None of these

Q4) When data is read from a file, it is automatically stored in a variable.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 14

Chapter 13: Introduction to Classes

Available Study Resources on Quizplus for this Chatper

54 Verified Questions

54 Flashcards

Source URL: https://quizplus.com/quiz/27283

Sample Questions

Q1) Which of the following is automatically called when an object is destroyed?

A) the constructor function

B) the specification deallocator

C) the destructor function

D) the destruction function

E) None of these

Q2) Which of the following is a directive used to create an "include guard" that allows a program to be conditionally compiled to prevent a header file from accidentally being included more than once?

A) #include

B) #guard

C) #ifndef

D) #endif

E) None of these

Q3) When an object is defined without an argument list for its constructor, the compiler automatically calls the object's default constructor.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above.

15

Chapter 14: More About Classes

Available Study Resources on Quizplus for this Chatper

46 Verified Questions

46 Flashcards

Source URL: https://quizplus.com/quiz/27284

Sample Questions

Q1) In the following function header, the word int is known as a(n) __________. FeetInches FeetInches:

: Operator++(int)

A) parameterless data type

B) incomplete argument

C) dummy parameter

D) incomplete parameter

E) None of these

Q2) An aggregate class's constructor can use a member initialization list to call the constructors for each of its member objects.

A)True

B)False

Q3) When you overload an operator, you can change the operator's original meaning to something entirely different.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 16

Chapter 15: Inheritance, Polymorphism, and Virtual Functions

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

Source URL: https://quizplus.com/quiz/27285

Sample Questions

Q1) The base class access specification can be viewed as a filter that base class members must pass through when becoming inherited members of a derived class.

A)True

B)False

Q2) Which is the derived class in the following statement?

Class Car :

Protected Vehicle

A) Car

B) Vehicle

C) protected

D) There is no way to tell.

E) None of these

Q3) The __________ constructor is called before the __________ constructor.

A) base, derived

B) derived, base

C) public, private

D) private, public

E) None of these

To view all questions and flashcards with answers, click on the resource link above. Page 17

Chapter 16: Exceptions and Templates

Available Study Resources on Quizplus for this Chatper

36 Verified Questions

36 Flashcards

Source URL: https://quizplus.com/quiz/27286

Sample Questions

Q1) Function templates allow you to write a single function definition that works with many data types.

A)True

B)False

Q2) A generic function that can work with any data type is called an exception template.

A)True

B)False

Q3) To handle an exception that has been thrown, a program must have a(n)

A) throw function

B) try/catch construct

C) fatal error

D) unrecoverable error

E) None of these

Q4) If you want to catch a bad_alloc exception in a program, you should include

A) #include &lt;iostream&gt;

B) #include &lt;alloc&gt;

C) #include &lt;new&gt;

D) None of these

To view all questions and flashcards with answers, click on the resource link above. Page 18

Chapter 17: The Standard Template Library

Available Study Resources on Quizplus for this Chatper

38 Verified Questions

38 Flashcards

Source URL: https://quizplus.com/quiz/27287

Sample Questions

Q1) An associative container uses __________ to access elements rapidly.

A) data

B) functions

C) keys

D) complex sort algorithms

E) None of these

Q2) A sequence container organizes data in a sequential fashion, similar to an array.

A)True

B)False

Q3) The algorithms provided by the STL are implemented as __________ and perform various operations on elements of containers.

A) virtual functions

B) function templates

C) global variables

D) private data members

E) None of these

Q4) An iterator is a function that is used to access items in an array.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 19

Chapter 18: Linked Lists

Available Study Resources on Quizplus for this Chatper

41 Verified Questions

41 Flashcards

Source URL: https://quizplus.com/quiz/27288

Sample Questions

Q1) In a circular linked list, the last node points to the

A) head pointer

B) tail pointer

C) first node

D) None of these

Q2) A linked list is called "linked" because each node in the series has a pointer that points to the next node in the list.

A)True

B)False

Q3) A linked list class must take care of removing the dynamically allocated nodes and this is done by

A) the constructor function

B) the destructor function

C) overriding the removal function

D) overloading the memory persistence operator

E) None of these

Q4) Nodes in a linked list are stored in contiguous memory.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 20

Chapter 19: Stacks and Queues

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

Source URL: https://quizplus.com/quiz/27289

Sample Questions

Q1) A dynamic queue can be implemented as a

A) dynamic linked list

B) fixed-length array

C) fixed-length circular array

D) All of these

E) None of these

Q2) The two primary stack operations are

A) push and pull

B) push and pop

C) insert and delete

D) append and delete

E) None of these

Q3) A stack queue can be implemented as a

A) circular array

B) stack

C) dynamic linked list

D) dynamic vector

E) None of these

To view all questions and flashcards with answers, click on the resource link above. Page 21

Chapter 20: Recursion

Available Study Resources on Quizplus for this Chatper

27 Verified Questions

27 Flashcards

Source URL: https://quizplus.com/quiz/27290

Sample Questions

Q1) When function A calls function B which, in turn, calls function A, this is known as

A) direct recursion

B) indirect recursion

C) function swapping

D) perfect recursion

E) None of these

Q2) When a recursive function directly calls itself, this is known as direct recursion.

A)True

B)False

Q3) A recursive function is designed to terminate when it reaches its

A) return statement

B) closing curly brace

C) last parameter

D) base case

E) None of these

Q4) A recursive function cannot call another function.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 22

Chapter 21: Binary Trees

Available Study Resources on Quizplus for this Chatper

39 Verified Questions

39 Flashcards

Source URL: https://quizplus.com/quiz/27291

Sample Questions

Q1) A binary tree with a height of three has

A) six nodes

B) one root and three nodes with two children each

C) three levels

D) three subtrees

E) None of these

Q2) Output will be the same if you use InOrder, PostOrder, or PreOrder traversals of the same binary tree.

A)True

B)False

Q3) In a binary tree, each node must have a minimum of two children.

A)True

B)False

Q4) When working with a binary tree, a node that has more than two children

A) will be cut back by the compiler

B) is theoretically impossible in a correctly developed binary tree structure

C) is known as a triplet node

D) None of these

To view all questions and flashcards with answers, click on the resource link above. Page 23

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
Object-Oriented Programming Review Questions - 949 Verified Questions by Quizplus - Issuu