Object-Oriented Programming Solved Exam Questions - 949 Verified Questions

Page 1


Object-Oriented Programming Solved Exam Questions

Course Introduction

Object-Oriented Programming introduces students to the principles and practices of designing software using the object-oriented paradigm. The course covers key concepts such as classes, objects, encapsulation, inheritance, and polymorphism, providing a robust framework for organizing complex code. Students learn to model real-world problems, implement reusable and maintainable code, and develop applications utilizing object-oriented methodologies. Through hands-on programming assignments and projects, learners gain proficiency in using at least one object-oriented programming language, such as Java, C++, or Python, preparing them for advanced topics in software 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) The purpose of a memory address is:

A) to identify the location of a byte in memory

B) to prevent multitasking

C) to obtain an algorithm

D) to improve the speed of processing

E) None of these

Answer: A

Q2) Which of the following is not a common input device?

A) keyboard

B) mouse

C) digital camera

D) printer

E) All are common input devices

Answer: D

Q3) The CPU is the most important component in a computer because without it, the computer could not run software.

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) Floating point constants are normally stored in memory as doubles.

A)True

B)False

Answer: True

Q3) The __________ causes the content of another file to be inserted into a program.

A) cout object

B) double slash (//)

C) #include directive

D) semicolon (;)

E) None of these

Answer: C

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

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) This manipulator is used to establish a field width for the value that follows it:

A) field_width

B) set_field

C) setw

D) iomanip

E) None of these

Answer: C

Q2) If you want to know the length of the string that is stored in a string object, you can call the object's size member function.

A)True

B)False

Answer: False

Q3) In C++, it is impossible to display the number 34.789 in a field of 9 spaces with 2 decimal places of precision.

A)True

B)False

Answer: False

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) Which of the following expressions will determine whether x is less than or equal to y?

A) x > y

B) x =< y

C) x >= y

D) x <= y

E) x == y and x < y

Q2) Both of the following if statements perform the same operation.

1. if (sales > 10000)

\(\quad\)\(\quad\)commissionRate = 0.15;

2. if (sales > 10000) commissionRate = 0.15;

A)True

B)False

Q3) If the expression on the left side of the following is False, the expression on the right side will not be checked.

(a > = b) && (c == d)

A)True

B)False

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

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) The statements in the body of a while loop may never be executed while the statements in the body of a do-while loop will be executed

A) at least once

B) at least twice

C) never

D) as many times as the user wishes

E) None of these

Q2) A for statement contains three expressions:

Initialization, test, and

A) update

B) reversal

C) null

D) validation

E) None of these

Q3) The while loop is a __________ loop.

A) post-test

B) pre-test

C) infinite

D) limited

E) None of these

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 function _________ eliminates the need to place a function definition before all calls to the function.

A) header

B) prototype

C) argument

D) parameter

E) None of these

Q2) Global variables are initialized to zero by default.

A)True

B)False

Q3) Local variables are initialized to zero by default.

A)True

B)False

Q4) What is the data type of the following function prototype's return value?

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) How many elements does the following array have?

Int values[1000];

A) 1000

B) 999

C) 1001

D) cannot tell from the code

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

A)True

B)False

Q3) The amount of memory used by an array depends on the array's data type and the number of elements in the array.

A)True

B)False

Q4) A two-dimensional array can be viewed as

A) rows and columns

B) arguments and parameters

C) increments and decrements

D) All of these

E) None of these

To view all questions and flashcards with answers, click on the resource link above. Page 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) A(n) __________ search uses a loop to sequentially step through an array.

A) binary

B) unary

C) linear

D) relative

E) None of these

Q2) When an array is sorted from highest to lowest, it is said to be in

A) reverse order

B) forward order

C) ascending order

D) descending order

E) None of these

Q3) A __________ search is more efficient than a __________ search.

A) character, string

B) integer, double

C) binary, linear

D) linear, binary

E) None of these

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

10

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) Which of the following is true about this statement: Sum += *array++;

A) This statement is illegal in C++.

B) This statement will cause a compiler error.

C) This statement assigns the dereferenced pointer's value, then increments the pointer's address.

D) This statement increments the dereferenced pointer's value by one, then assign that value.

E) None of these

Q2) When the less than operator (<) is used between two pointer values, the expression is testing whether

A) the value pointed to by the first is less than the value pointed to by the second

B) the value pointed to by the first is greater than the value pointed to by the second

C) the address of the first variable comes before the address of the second variable in the computer's memory

D) the first variable was declared before the second variable

E) None of these

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

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) The function that converts a C-string to an integer and returns the integer value is A) atoint

B) strtoint

C) strint

D) atoi

E) None of these

Q2) The function that accepts a C-string containing a number as its argument and returns the integer equivalent is

A) strToInt

B) itoa

C) atoi

D) int_from

E) None of these

Q3) The isdigit function will return true if the argument is a digit between 0 and 9.

A)True

B)False

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

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) Given the structure definition shown, assume that circle1 and circle2 are variables of the Circle type and their members have been initialized. struct Circle

{ \(\quad\)double centerX; \(\quad\)double centerY; \(\quad\)double radius; };

Then, is it true or False that the following statement correctly determines whether the two variables' members contain the same data?

if (circle1 == circle2)

A)True

B)False

Q2) When a programmer creates an abstract data type, he or she can decide what values are acceptable for the data type, as well as what operations may be performed on the data type.

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) Which of the following statements opens a file named info.txt for both input and output?

A) dataFile.open("info.txt", ios::in && ios::out);

B) dataFile.open("info.txt", ios::in, ios::out);

C) dataFile.open("info.txt", input || output);

D) dataFile.open("info.txt", ios::in | ios::out);

E) None of these

Q2) By default, files are opened in binary mode.

A)True

B)False

Q3) Which of the following is the data type that can be used to create files and write information to them but cannot be used to read information from them?

A) ofstream

B) ifstream

C) afstream

D) outstream

E) None of these

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

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) You must use the private access specification for all data members of a class.

A)True

B)False

Q2) Objects in an array are accessed with __________.

A) subscripts

B) parentheses

C) #include statements

D) output format manipulators

E) None of these

Q3) The process of object-oriented analysis can be viewed as the following steps:

A) identify objects, then define each object's attributes, behaviors, and relationships

B) define data members and member functions, then assign the class name

C) declare public and private variables, prototype functions, and then write code

D) write the main() function, then determine which classes are needed

E) None of these

Q4) More than one destructor function may be defined for a class.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 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) If you do not furnish a(n) __________, an automatic memberwise copy will be performed when one object is assigned to another object.

A) overloaded constructor function

B) overloaded assignment operator

C) default constructor function

D) overloaded copy operator

E) None of these

Q2) An ___________ operator can work with programmer-defined data types.

A) inline

B) unconditional

C) overloaded

D) undefined

E) None of these

Q3) When objects contain pointers, it is a good idea to create an explicit __________ function.

A) destructor

B) copy constructor

C) static constructor

D) inline constructor

E) None of these

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) A derived class may not have any classes derived from it.

A)True

B)False

Q2) A __________ of a base class expects to be overridden in a derived class.

A) constructor function

B) destructor function

C) static function

D) virtual function

E) None of these

Q3) The following statement allows the __________ members of the Car class to access __________ members of the Vehicle class. class Car : Public Vehicle

A) private, private

B) public, private

C) protected, private

D) public, protected

E) None of these

Q4) A derived class may become a base class if another class is derived from it.

A)True

B)False

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) All type parameters defined in a function template must appear at least once in the A) function parameter list

B) preprocessor directives

C) function call

D) type.h file

E) None of these

Q2) What does the T represent in the following statement?

Template < class T >

A) the name of the function template

B) T stands for Template

C) a generic data type that is used in a function template

D) the int data type

E) None of these

Q3) A(n) __________ is a value or an object that signals an error.

A) destructor

B) template

C) throw

D) exception

E) 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) To use the map class, you must include

A) #include&lt;key&gt;

B) #include&lt;key_value&gt;

C) #include&lt;map&gt;

D) #include&lt;multimap&gt;

E) None of these

Q2) The STL provides many algorithms which are implemented as function templates and are included in the &lt;algorithm&gt; header file.

A)True

B)False

Q3) Select all that apply. Which of the following are member functions of the vector class that use emplacement?

A) insert()

B) push_back()

C) emplace()

D) emplace_back()

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) ADT stands for

A) Algorithm Dependent Template

B) Algorithm Driven Template

C) Abstract Data Type

D) Automatic Data Type

E) None of these

Q2) Deleting an entire list simply requires the use of the delete operator.

A)True

B)False

Q3) A linked list is a series of connected

A) ADTs

B) vectors

C) algorithms

D) nodes

E) None of these

Q4) If there are no nodes in a linked list, you cannot append a node to the list.

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) Select all that apply. A practical application of the stack data type in a computer system is

A) storage of local variables

B) tracking nested loops

C) tracking nested function calls

D) None of these

Q2) The two most common queue operations are endeque and deque.

A)True

B)False

Q3) The first item placed onto a stack is always the last item removed from the stack.

A)True

B)False

Q4) Select all that apply. The queue data structure is commonly applied in connection with

A) managing the order of print jobs

B) communications software

C) operating systems

D) 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) Like a loop, a recursive function must have some method to control the number of times it repeats.

A)True

B)False

Q2) How many times will the following function call itself if 5 is passed as the argument? void showMessage(int n)

{

\(\quad\)If (n > 0)

\(\quad\){

\(\quad\)\(\quad\)cout << "Good day!" << endl; \(\quad\)\(\quad\)showMessage(n + 1); \(\quad\)}

} A) 1

B) 4

C) 5

D) An infinite number of times

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) Binary trees are commonly used to organize key values that index database records.

A)True

B)False

Q2) The first node in a binary tree list is called the A) head pointer

B) binary node

C) root node

D) pointer node

E) None of these

Q3) Deleting a leaf node from a binary tree is not difficult but deleting a non-leaf node requires several steps.

A)True

B)False

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

A)True

B)False

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