Object-Oriented Programming Exam Preparation Guide - 899 Verified Questions

Page 1


Object-Oriented Programming Exam Preparation Guide

Course Introduction

Object-Oriented Programming introduces the fundamental principles and techniques of object-oriented design and programming. This course covers concepts such as classes, objects, inheritance, encapsulation, polymorphism, and abstraction, with a focus on applying these ideas to solve computational problems. Students will learn to structure software programs using the object-oriented paradigm, develop modular and maintainable code, and utilize industry-standard programming languages and environments. Through hands-on assignments and projects, learners will gain practical experience in designing, implementing, testing, and debugging object-oriented applications.

Recommended Textbook

C++ Programming From Problem Analysis to Program Design 6th Edition by D.S. Malik

Available Study Resources on Quizplus

18 Chapters

899 Verified Questions

899 Flashcards

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

Chapter 1: An Overview of Computers and Programming Languages

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Information stored in main memory must be transferred to some other device for permanent storage.

A)True

B)False

Answer: True

Q2) A sequence of eight bits is called a ____.

A) binary digit

B) byte

C) character

D) double

Answer: B

Q3) Several categories of computers exist, such as ____.

A) microframe, midframe, and miniframe

B) midsize, microframe, and mainframe

C) mainsize, midsize, and microsize

D) mainframe, midsize, and micro

Answer: D

Q4) Word processors, spreadsheets, and games are examples of

Answer: application programs applications

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

Chapter 2: Basic Elements of C

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) The value of the expression 33/10, assuming both values are integral data types, is

A) 0.3

B) 3

C) 3.0

D) 3.3

Answer: B

Q2) Which of the following is a reserved word in C++?

A) char

B) Char

C) CHAR

D) character

Answer: A

Q3) ____________________ functions are those that have already been written and are provided as part of the system.

Answer: Predefined predefined Standard standard

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

Page 4

Chapter 3: Inputoutput

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) In C++, the dot is an operator called the ____________________operator.

Answer: member access

Q2) Suppose that x and y are int variables, ch is a char variable, and the input is: 4 2 A 12

Choose the values of x, y, and ch after the following statement executes: Cin >> x >> ch >> y;

A) x = 4, ch = 2, y = 12

B) x = 4, ch = A, y = 12

C) x = 4, ch = ' ', y = 2

D) This statement results in input failure

Answer: D

Q3) C++ comes with a wealth of functions, called ____________________ functions, that are written by other programmers. Answer: predefined pre defined pre-defined

Q4) In the C++ statement, cin.get(u); u must be a variable of type ____________________.

Answer: char

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

Chapter 4: Control Structures I Selection

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Which of the following is a relational operator?

A) =

B) ==

C) !

D) &&

Q2) The expression in an if statement is sometimes called a(n) ____.

A) selection statement

B) action statement

C) decision maker

D) action maker

Q3) Every else must be paired with a(n) ____________________.

Q4) Suppose x is 5 and y is 7. Choose the value of the following expression: (x != 7) && (x <= y)

A) false

B) true

C) 0

D) null

Q5) Putting ____________________ in front of a logical expression reverses the value of that logical expression.

Page 6

Q6) The value of the expression 7 + 8 <= 15 is ____________________.

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

Chapter 5: Control Structures II Repetition

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) A semicolon at the end of the for statement (just before the body of the loop) is a(n) ____________________ error.

Q2) What is the initial statement in the following for loop? (Assume that all variables are properly declared.) int i; for (i = 1; i < 20; i++) \(\quad\)cout << "Hello World"; cout << "!" << endl; A) i = 1; B) i < 20; C) i++; D) cout << "Hello World";

Q3) In a counter-controlled while loop, the loop control variable must be initialized before the loop. A)True B)False

Q4) To generate a random number, you can use the function rand of the header file

Q5) A do...while loop is a(n) ____________________ loop, since the loop condition is evaluated after executing the body of the loop.

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

Chapter 6: User-Defined Functions

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) A(n) ____________________ parameter s a formal parameter that receives a copy of the content of the corresponding actual parameter.

Q2) Once you write and properly debug a function, you can use it in the program (or different programs) again and again without having to rewrite the same code repeatedly.

A)True

B)False

Q3) Using functions greatly enhances a program's readability because it reduces the complexity of the function main.

A)True

B)False

Q4) A(n) ____________________ parameter is a formal parameter that receives the location (memory address) of the corresponding actual parameter.

Q5) In C++, :: is called the ____________________.

Q6) The following return statement returns the value 10. return 10, 16; A)True B)False

Q7) A function ____________________ is a function that is not fully coded.

Page 8

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

Chapter 7: User-Defined

Simple Data Types, Namespaces, and the String Type

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) The following statement creates an anonymous type: enum {1ST, 2ND, 3RD, 4TH} places;

A)True

B)False

Q2) The scope of a namespace member is local to the ____.

A) function

B) block

C) file

D) namespace

Q3) Before using the data type string, the program must include the header file ____.

A) enum

B) iostream

C) string

D) std

Q4) For the operator + to work with the string data type, one of the operands of + must be a(n) ____________________ variable.

Q5) The string expression strVar.____________________ deletes n characters from strVar starting at position pos.

9

Q6) The values in the domain of an enumeration type are called

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

Page 10

Chapter 8: Arrays and Strings

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Suppose that sales is an array of 50 components of type double. Which of the following correctly initializes the array sales?

A) for (int 1 = 1; j <= 49; j++)

Sales[j] = 0;

B) for (int j = 1; j <= 50; j++)

Sales[j] = 0;

C) for (int j = 0; j <= 49; j++)

Sales[j] = 0.0;

D) for (int j = 0; j <= 50; j++)

Sales[j] = 0.0;

Q2) The header file string contains the function ____________________,which converts a value of type string to a null-terminated character array.

Q3) Which of the following correctly declares and initializes alpha to be an array of four rows and three columns with the component type int?

A) int alpha[4][3] = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}};

B) int alpha[4][3] = {0,1,2; 1,2,3; 2,3,4; 3,4,5};

C) int alpha[4][3] = {0,1,2: 1,2,3: 2,3,4: 3,4,5};

D) int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}};

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

Chapter 9: Records Structs

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Consider the following statements: struct supplierType { \(\quad\)string name; \(\quad\)int supplierID; }; struct paintType { \(\quad\)supplierType supplier; \(\quad\)string color; \(\quad\)string paintID; };

paintType paint;

What is the data type of paint.supplier?

A) string

B) paintType

C) supplierType

D) struct

Q2) A function can return a value of the type array. A)True

B)False

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

Page 12

Chapter 10: Classes and Data Abstraction

Available Study Resources on Quizplus for this Chatper

49 Verified Questions

49 Flashcards

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

Sample Questions

Q1) If a function of a class is static, it is declared in the class definition using the keyword static in its ____.

A) return type

B) parameters

C) heading

D) main function

Q2) A ____ sign in front of a member name on a UML diagram indicates that this member is a protected member.

A) +

B) -

C) #

D) $

Q3) The word ____ at the end of the member functions in the accompanying class clockType in Figure 1 specifies that these functions cannot modify the member variables of a clockType object.

A) static

B) const

C) automatic

D) private

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

Page 13

Chapter 11: Inheritance and Composition

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Which of the following is true about a derived class?

A) A derived class can directly access any member variable of the base class.

B) A derived class can redefine any public member function of the base class.

C) A derived class can have at most one base class.

D) A derived class can redefine any member function of the base class.

Q2) Objects are created when ____________________ variables are declared.

Q3) The private members of a base class can be directly accessed by a derived class.

A)True

B)False

Q4) A derived class cannot directly access public members of a base class.

A)True

B)False

Q5) C++ provides ____ functions as a means to implement polymorphism in an inheritance hierarchy, which allows the run-time selection of appropriate member functions.

A) redefined

B) overridden

C) virtual

D) overloaded

Q6) In C++, we implement ADT through the use of ____________________.

Page 14

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

Chapter 12: Pointers, Classes, Virtual Functions, and

Abstract Classes

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) In C++, ____ is called the address of operator.

A) &

B) *

C) #

D) ->

Q2) Which of the following arithmetic operations is allowed on pointer variables?

A) Increment

B) Modulus

C) Multiplication

D) Division

Q3) Given the declaration int *a;, the statement a = new int[50]; dynamically allocates an array of 50 components of the type ____.

A) int

B) int*

C) pointer

D) address

Q4) In C++, the member access operator arrow is >>.

A)True

B)False

Page 15

Q5) The binding of virtual functions occurs at program

time.

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

Page 16

Chapter 13: Overloading and Templates

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Class templates are called ____ types.

A) polymorphic

B) structured

C) member

D) parameterized

Q2) Operators can be overloaded either for objects of the user-defined types, or for a combination of objects of the user-defined type and objects of the built-in type.

A)True

B)False

Q3) The return type of the function operator == is ____.

A) int

B) bool

C) char

D) void

Q4) In C++, operator is a reserved word.

A)True

B)False

Q5) The ____________________ operator causes a member-wise copy of the member variables of the class.

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

Chapter 14: Exception Handling

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Which of the following is a valid C++ statement?

A) assert(0 = divisor);

B) assert(divisor != 0);

C) assert(divisor 0);

D) assert(divisor is 0);

Q2) When an exception is thrown in a function, the function-call stack is ____ so that the exception can be caught in the next try/catch block.

A) destroyed

B) allocated

C) unbound

D) unwound

Q3) In C++, throw is a(n) ____________________ word.

Q4) The code to handle exceptions depends on the type of application you develop.

A)True

B)False

Q5) The logic_error and runtime_error classes are defined in the header file ____.

A) stdex

B) stdlib

C) stdexcept

D) exception

18

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

Chapter 15: Recursion

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Consider the accompanying definition of a recursive function. Which of the statements represent the general case?

A) Statements in Lines 3-11

B) Statements in Lines 5-6

C) Statements in Lines 5-11

D) Statements in Lines 7-11

Q2) Consider the following code. int fact(int num)

{ if (num == 0)

\(\quad\)return 1; else

\(\quad\)return num * fact(num - 1); }

The function fact is an example of a(n) ____________________ recursive function.

Q3) If a function A calls a function B and function B calls function A, then function A is ____________________ recursive.

Q4) With recursion, the base case must eventually be reduced to a general case. A)True B)False

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

Chapter 16: Searching, Sorting and the Vector Type

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Which of the following statements declares intList to be a vector of size 5 and the element to be of type int?

A) vector intList[5];

B) vector&lt;int&gt; intList(5); C) vector&lt;int&gt; intList(); D) vector(int) intList[5];

Q2) The type vector provides the expression ____________________, which returns true if the object vecList is empty and false otherwise.

Q3) If you want to use the class vector in your program, you must include the following statement: ____________________.

Q4) All of the values in a list have the same type. A)True B)False

Q5) The first element in a vector object is at location ____________________.

Q6) The statement ____ creates the vector object vecList of size size.

A) vector[elemType] vecList(size); B) vector&lt;elemType&gt; vecList(size); C) vector(size) vecList&lt;elementType&gt; D) vector{ele

Page 20

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

Chapter 17: Linked Lists

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample

Questions

Q1) Consider the accompanying code. What is the effect of the following statement? newNode->info = 50;

A) Stores 50 in the info field of the newNode

B) Creates a new node

C) Places the node at location 50

D) Cannot be determined from this code

Q2) The ____________________ operator advances the iterator to the next node in the linked list.

Q3) Suppose that the pointer head points to the first node in the list, and the link of the last node is NULL. The first node of the linked list contains the address of the ____ node. A) head

B) first

C) second

D) tail

Q4) Linked lists allow you to overcome the size limitations of an array data type. A)True

B)False

Q5) The ____________________ constructor can make an identical copy of a linked list.

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

Chapter 18: Stacks and Queues

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) The postfix expression 2 4 6 * + 15 - 21 7 / + = evaluates to ____.

A) 4

B) 14

C) 24

D) 26

Q2) A(n) ____________________ system consists of servers and queues of objects waiting to be served.

Q3) Postfix notation requires the use of parentheses to enforce operator precedence.

A)True

B)False

Q4) In a(n) ____________________ array, the first array position immediately follows the last array position.

Q5) Which of the following is listed in the chapter as a basic operation performed on a queue?

A) push

B) pop

C) isEmptyQueue

D) top

Q6) If the queue is empty, the operation ____________________ terminates the program.

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

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 Exam Preparation Guide - 899 Verified Questions by Quizplus - Issuu