Object-Oriented Programming Exam Preparation Guide - 1050 Verified Questions

Page 1


Object-Oriented Programming Exam Preparation Guide

Course

Introduction

Object-Oriented Programming introduces students to the fundamentals of structuring software using the object-oriented paradigm. The course covers key concepts such as classes, objects, inheritance, encapsulation, and polymorphism, emphasizing how these principles lead to modular, reusable, and maintainable code. Students will learn to design and implement programs using an object-oriented language, applying techniques for class hierarchies, interfaces, and dynamic binding. Real-world examples and projects enable hands-on experience, preparing students to employ object-oriented thinking to solve complex programming challenges effectively.

Recommended Textbook C++ Programming Program Design Including Data Structures 6th Edition by D.S. Malik

Available Study Resources on Quizplus

21 Chapters

1050 Verified Questions

1050 Flashcards

Source URL: https://quizplus.com/study-set/319 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/128444

Sample Questions

Q1) 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

Q2) To develop a program to solve a problem,you start by ____.

A) analyzing the problem

B) implementing the solution in C++

C) designing the algorithm

D) entering the solution into a computer system

Answer: A

Q3) The command that does the linking on Visual C++ 2010 Express and Visual Studio 2010 is Make or Remake.

A)True

B)False

Answer: False

Q4) The machine language version of the high-level language program is called a(n)____________________.

Answer: object program

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/5305

Sample Questions

Q1) In a C++ program,____________________ are used to separate special symbols,reserved words,and identifiers.

Answer: whitespaces whitespace

white spaces white space

Q2) Suppose that alpha and beta are int variables.The statement alpha = ++beta; is equivalent to the statement(s)____.

A) beta = beta + 1; Alpha = beta;

B) alpha = beta; Beta = beta + 1;

C) alpha = alpha + beta;

D) alpha = beta + 1;

Answer: A

Q3) A(n)____________________ is a sequence of zero or more characters. Answer: string

Q4) ____________________ rules determine the meaning of instructions. Answer: Semantic semantic

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

Chapter 3: Input/Output

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Suppose that ch1,ch2,and ch3 are variables of the type char and the input is: A B C

Choose the value of ch3 after the following statement executes: Cin >> ch1 >> ch2 >> ch3;

A) 'A'

B) 'B'

C) 'C'

D) '\n'

Answer: C

Q2) C++ provides a header file called ____________________,which is used for file I/O.

Answer: fstream

Q3) The functions get,ignore,and so on are members of the data type ____________________.

Answer: istream

Q4) In the statement cin >> x;,x can be a variable or an expression.

A)True

B)False

Answer: False

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/5307

Sample Questions

Q1) In a ____ control structure,the computer executes particular statements depending on some condition(s).

A) looping

B) repetition

C) selection

D) sequence

Q2) In C++,!,&&,and || are called relational operators.

A)True

B)False

Q3) Assume you have three int variables: x = 2,y = 6,and z.Choose the value of z in the following expression: z = (y / x > 0)? x : y;.

A) 2

B) 3

C) 4

D) 6

Q4) When one control statement is located within another,it is said to be ____.

A) blocked

B) compound

C) nested

D) closed

Page 6

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/128467

Sample Questions

Q1) The statement in the body of a while loop acts as a decision maker. A)True B)False

Q2) Suppose sum and num are int variables,and the input is 18 25 61 6 -1.What is the output of the following code? sum = 0; Cin >> num; While (num != -1)

{

\(\quad\)Sum = sum + num; \(\quad\)Cin >> num;

}

Cout << sum << endl;

A) 92

B) 109

C) 110

D) 119

Q3) In a(n)"____________________" problem,either the loop executes one too many or one too few times.

Q4) The function eof is a member of the data type ____________________.

Page 7

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

Chapter 6: User-Defined Functions

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) 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

Q2) ____________________ identifiers are not accessible outside of the function (block).

Q3) The output of the statement: cout << pow(2.0,pow(3.0,1.0))<< endl; Is ____.

A) 6.0

B) 7.0

C) 8.0

D) 9.0

Q4) Stream variables (for example,ifstream and ofstream)should be passed by ____________________ to a function.

Q5) If a function needs to return more than one value,as a rule of good programming style,you should change it to a(n)____________________ function and use the appropriate reference parameters to return the values.

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

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/5310

Sample Questions

Q1) Consider the following statements: string str1 = "Gone with the wind"; String str2;

After the statement str2 = str1.substr(5,4); executes,the value of str2 is "____".

A) Gone

B) with

C) the

D) wind

Q2) The string expression strVar.____________________ returns the index of the first occurrence at or after pos where str is found in strVar.

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

A) enum

B) iostream

C) string

D) std

Q4) In July ____,ANSI/ISO Standard C++ was officially approved.

A) 1996

B) 1998

C) 1999

D) 2000

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

Chapter 8: Arrays and Strings

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) What is the value of alpha[2] after the following code executes? int alpha[5]; int j; for (j = 0; j < 5; j++)

\(\quad\)alpha[j] = 2 * j + 1;

A) 1

B) 4

C) 5

D) 6

Q2) Consider the following statement: double alpha[10][5];.The number of components of alpha is ____.

A) 15

B) 50

C) 100

D) 150

Q3) Assume you have the following declaration char nameList[100];.Which of the following ranges is valid for the index of the array nameList?

A) 0 through 99

B) 0 through 100

C) 1 through 100

D) 1 through 101

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

Chapter 9: Records (structs)

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Consider the following statements: struct rectangleData

{ \(\quad\)double length; \(\quad\)double width; \(\quad\)double area; \(\quad\)double perimeter; };

rectangleData bigRect;

Which of the following statements is valid in C++?

A) cin >> bigRect.length >> width;

B) cout << bigRect.length;

C) cout << bigRect;

D) cout << length;

Q2) You can use the assignment statement on structs.

A)True

B)False

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

Q4) Memory is allocated for struct variables only when you ____________________ them.

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

Chapter 10: Classes and Data Abstraction

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) If an object is created in a user program,then the object can access both the public and private members of the class.

A)True

B)False

Q2) In C++,you can pass a variable by reference and still prevent the function from changing its value by using the keyword ____ in the formal parameter declaration.

A) automatic

B) private

C) static

D) const

Q3) A(n)____________________ is a statement specifying the condition(s)that must be true before the function is called.

Q4) In C++ terminology,a class object is the same as a class instance.

A)True

B)False

Q5) A class is an example of a structured data type.

A)True

B)False

Q6) The header file is also known as the ____________________.

Page 12

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

Chapter 11: Inheritance and Composition

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

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

A)True

B)False

Q2) In ____________________,the derived class is derived from a single base class.

Q3) 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.

Q4) The preprocessor directive ____________________ is used to prevent multiple inclusions of a header file in a program.

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

A)True

B)False

Q6) ____ is a "has-a" relationship.

A) Inheritance

B) Encapsulation

C) Composition

D) Polymorphism

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

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

Chapter 12: Pointers, Classes, Virtual Functions, Abstract

Classes, and Lists

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) The C++ operator ____ is used to create dynamic variables.

A) dynamic

B) new

C) virtual

D) dereferencing

Q2) For classes with pointer member variables,you should include the copy constructor and the ____________________ in the class.

Q3) A memory leak is an unused memory space that cannot be allocated.

A)True

B)False

Q4) In a(n)____ copy,two or more pointers have their own data.

A) shallow

B) deep

C) static

D) dynamic

Q5) The ____________________ of a list is the number of elements in the list.

Q6) Variables that are created during program execution are called static variables. A)True

Page 14

B)False

Q7) The binding of virtual functions occurs at program

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

Page 15

Chapter 13: Overloading and Templates

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

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

A)True

B)False

Q2) When the post-increment operator is overloaded as a nonmember function of the class,the operator function has ____ parameter(s).

A) no

B) one

C) two

D) three

Q3) Which of the following function prototypes overloads the != operator for the class rectangleType?

A) bool operator!=(rectangle&) const;

B) bool operator!=(const rectangleType&) const;

C) int operator!=(const rectangleType) const;

D) int operator!=(rectangle&) const;

Q4) The associativity of the operator = is from right to left.

A)True

B)False

Q5) In C++,a function ____________________ can be overloaded.

Q6) A conversion constructor is a(n)____________________ parameter function.

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

Chapter 14: Exception Handling

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) In C++,any class can be considered an exception class.

A)True

B)False

Q2) The function ____ can check whether an expression meets the required conditions; if the conditions are not met,it terminates the program.

A) check

B) look

C) assert

D) what

Q3) 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);

Q4) The class ____ is designed to deal with illegal arguments used in a function call.

A) invalid_function

B) invalid_parameter

C) invalid_call

D) invalid_argument

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

Chapter 15: Recursion

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

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

Q2) Consider the following definition of the recursive function mystery. int mystery(int num)

{ if (num <= 0)

\(\quad\)return 0; else if (num % 2 == 0)

\(\quad\)return num + mystery(num - 1); else

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

What is the output of the following statement?

Cout << mystery(5)<< endl;

A) 50

B) 65

C) 120

D) 180

Q3) The numbering system that the computer uses is called the ____________________ system.

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

Chapter 16: Linked Lists

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Every node (except of the last node)in a singly linked list contains ____.

A) the next node

B) no address information

C) the address of the next node

D) the address of the previous node

Q2) If a formal parameter is a value parameter,the ____________________ constructor provides the formal parameter with its own copy of the data.

Q3) In a linked list,the link component of each node is a(n)____________________.

Q4) Each node of a linked list must store the data as well as the ____________________ for the next node in the list.

Q5) A(n)____________________ linked list is a linked list in which every node has a next pointer and a back pointer.

Q6) Each node of a singly linked list has two components: ____ and ____.

A) info, head

B) link, back

C) back, head

D) info, link

Q7) A linked list must be searched ____________________,starting from the first node.

Page 19

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

Chapter 17: Stacks and Queues

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) The expression a + b is the same in both infix notation and postfix notation.

A)True

B)False

Q2) In evaluating a postfix expression,when an equal sign (=)is encountered,how many elements must the stack contain so that no error is generated?

A) none

B) one

C) two

D) three

Q3) In the array representation of a stack,an unlimited number of elements can be pushed onto the stack.

A)True

B)False

Q4) In ____________________ notation,operators are written after the operands.

Q5) The postfix expression 3 5 + 2 ; 6 - = will generate an error,because it ____. A) contains an illegal operator

B) does not have enough operands

C) has too many operands

D) has too many operators

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

Chapter 18: Searching and Sorting Algorithms

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Let f be a function of n.By the term ____________________,we mean the study of the function f as n becomes larger and larger without bound.

Q2) The sequential search algorithm does not require that the list be sorted.

A)True

B)False

Q3) The quick sort algorithm uses the ____________________ technique to sort a list.

Q4) Consider the following list: int list[] = {4,8,19,25,34,39,45,48,66,75,89,95}

When performing a binary search,the target is first compared with ____.

A) 4

B) 25

C) 39

D) 95

Q5) During the sorting phase of insertion sort,the array containing the list is divided into two sublists,sorted and unsorted.

A)True

B)False

Q6) A comparison tree is a(n)____________________ tree.

Q7) The ____________________ search algorithm is the optimal worst-case algorithm for solving search problems by using the comparison method.

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

Chapter 19: Binary Trees

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) To destroy a binary tree,for each node,first we destroy its left subtree,then its right subtree,and then the node itself.We must then use the operator ____________________ to deallocate the memory occupied by the node.

Q2) In addition to the inorder,preorder,and postorder traversals,a binary tree can also be traversed level-by-level,which is also known as ____________________ traversal.

Q3) Every node in a binary tree has at most ____ children.

A) one

B) two

C) three

D) four

Q4) In the diagram of a binary tree,an arrow is called a(n)____.

A) relation

B) path

C) directed line

D) directed branch

Q5) In a(n)____________________ traversal,the binary tree is traversed as follows:

1.Traverse the left subtree

2.Visit the node

3.Traverse the right subtree

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

Chapter 20: Graphs

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Let G be a weighted graph.Let u and v be two vertices in G,and let P be a path in G from u to v.The weight of the path P is the sum of the weights of all the ____________________ on the path P.

Q2) Y is a(n)____ of X if every element of Y is also an element of X.

A) derivative B) subset

C) inheritee

D) shallow copy

Q3) We can always traverse an entire graph from a single vertex. A)True B)False

Q4) A graph is ____________________ if the number of vertices is zero.

Q5) Let e (u,v)be an edge in an undirected graph G.The edge e is said to be ____________________ on the vertices u and v.

Q6) The starting vertex of a shortest path in a graph is called the ____________________.

Q7) A(n)____________________ graph G is called strongly connected if any two vertices in G are connected.

Page 23

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

Chapter 21: Standard Template Library (STL)

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) If data needs to be processed in a LIFO manner,use a ____.

A) stack

B) linked list

C) queue

D) deque

Q2) The associated header file of the sequence container multimap is ____________________.

Q3) ____ containers allow elements to be inserted at both ends.

A) Queue

B) Deque

C) Stack

D) List

Q4) An iterator to a vector container is declared using the ____ iterator.

A) new

B) vector

C) typedef

D) typeiter

Q5) ____________________ predicates check a specific property for a pair-that is,two arguments.

Q6) ____________________ predicates check a specific property for a single argument.

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

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 - 1050 Verified Questions by Quizplus - Issuu