Skip to main content

Advanced C++ Programming Exam Questions - 1050 Verified Questions

Page 1


Advanced C++ Programming Exam

Questions

Course Introduction

Advanced C++ Programming delves into sophisticated aspects of the C++ language, focusing on object-oriented design, generic programming with templates, advanced use of the Standard Template Library (STL), and effective memory management. The course explores complex topics such as inheritance hierarchies, polymorphism, operator overloading, exception handling, and smart pointers. Students also learn about multi-threading, lambda expressions, modern C++ standards (C++11 and beyond), and best practices for writing efficient, maintainable code. Practical programming assignments reinforce theoretical concepts by challenging students to design, implement, and debug real-world applications using advanced C++ features.

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) When the computer is turned off,everything in secondary memory is lost.

A)True

B)False

Answer: False

Q2) ____ programs perform a specific task.

A) Application

B) System

C) Operating

D) Service

Answer: A

Q3) When the power is switched off,everything in ____ is lost.

A) main memory

B) secondary storage

C) hard disks

D) floppy disks

Answer: A

Q4) In object-oriented design,the first step in the problem-solving process is to identify the components called ____________________,which form the basis of the solution,and to determine how they interact with one another.

Answer: objects

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) The value of the expression 17 % 7 is ____.

A) 1

B) 2

C) 3

D) 4

Answer: C

Q2) The declaration int a,b,c; is equivalent to which of the following?

A) inta , b, c;

B) int a,b,c;

C) int abc;

D) int a b c;

Answer: B

Q3) The maximum number of significant digits in float values is up to 6 or 7.

A)True

B)False

Answer: True

Q4) A(n)____________________ is a memory location whose contents can be changed.

Answer: variable

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

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 alpha,beta,and gamma are int variables and the input is:

100 110 120

200 210 220

300 310 320

What is the value of gamma after the following statements execute? cin >> alpha; cin.ignore(100,'\n'); cin >> beta; cin.ignore(100,'\n'); cin >> gamma;

A) 100

B) 200

C) 300

D) 320

Answer: C

Q2) In an output statement,each occurrence of endl advances the cursor to the end of the current line on an output device.

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) Which of the following is a relational operator?

A) =

B) ==

C) !

D) &&

Q2) To develop a program,you can use an informal mixture of C++ and ordinary language,called ____.

A) assert code

B) pseudocode

C) cppcode

D) source code

Q3) The conditional operator ?: takes ____ arguments.

A) two

B) three

C) four

D) five

Q4) The operators != and == have the same order of precedence.

A)True

B)False

Q5) The symbol > is a(n)____________________ operator.

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) In a while and for loop,the loop condition is evaluated before executing the body of the loop.Therefore,while and for loops are called ____________________ loops.

Q2) In a counter-controlled while loop,the loop control variable must be initialized before the loop.

A)True B)False

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

Q4) The function srand takes as input a(n)____________________ int,which acts as the seed for the algorithm.

Q5) A loop ____________________ is a set of statements that remains true each time the loop body is executed.

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

Q7) The ____________________ loop has an exit condition but no entry condition.

Q8) The statement in the body of a while loop acts as a decision maker.

A)True B)False

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

Sample Questions

Q1) Given the following function prototype: int test(float,char);,which of the following statements is valid?

A) cout << test(12, &);

B) cout << test("12.0", '&');

C) int u = test(5.0, '*');

D) cout << test('12', '&');

Q2) A variable or expression listed in a call to a function is called the ____.

A) formal parameter

B) actual parameter

C) data type

D) type of the function

Q3) The execution of a return statement in a user-defined function terminates the program.

A)True

B)False

Q4) The output of the statement: cout << pow(3.0,2.0)+ 5 << endl; is ____.

A) 11.0

B) 12.0

C) 13.0

D) 14.0

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) In C++,namespace is a reserved word.

A)True

B)False

Q2) Which of the following statements is used to simplify the accessing of all globalType namespace members?

A) using globalType;

B) using namespace globalType:all;

C) using namespace globalType::all;

D) using namespace globalType;

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

Q4) In C++,____ is called the scope resolution operator.

A) \(.\)

B) \(?\)

C) :

D) ::

Q5) A data type wherein you directly specify values in the variable declaration with no type name is called a(n)____________________type.

Q6) The length of the string "Hello There." is ____________________.

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) Consider the statement int list[10][8];.Which of the following about list is true?

A) list has 10 rows and 8 columns.

B) list has 8 rows and 10 columns.

C) list has a total of 18 components.

D) list has a total of 108 components.

Q2) All components of an array are of the same data type.

A)True

B)False

Q3) Suppose list is a one dimensional array of size 25,wherein each component is of type int.Further,suppose that sum is an int variable.The following for loop correctly finds the sum of the elements of list.

sum = 0; for (int i = 0; i < 25; i++) sum = sum + list; A)True B)False

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

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 supplierType { \(\quad\)String name; \(\quad\)Int supplierID; }; struct applianceType { \(\quad\)supplierType supplier; \(\quad\)string modelNo; \(\quad\)double cost; };

applianceType applianceList[25];

Which of the following best describes applianceList?

A) It is a multidimensional array.

B) It is a struct.

C) It is an array of structs.

D) It is a struct of arrays.

Q2) A(n)____________________ is a collection of a fixed number of components in which the components are accessed by name.

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

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) In C++,class is a reserved word and it defines only a data type.

A)True

B)False

Q2) Non-static member variables of a class are called the ____________________ variables of the class.

Q3) By default,all members of a class are ____________________.

Q4) If the heading of a member function of a class ends with the word const,then the function member cannot modify the private member variables,but it can modify the public member variables.

A)True

B)False

Q5) As parameters to a function,class objects can be passed by reference only. A)True

B)False

Q6) If a class object is passed by ____________________,the contents of the member variables of the actual parameter are copied into the corresponding member variables of the formal parameter.

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

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) In OOD,a program is a collection of interacting ____________________; in structured programming,a program is a collection of interacting functions.

Q2) The new classes that we create from existing classes are called ____ classes.

A) sibling

B) base

C) derived D) parent

Q3) In ____________________ (aggregation),one or more members of a class are objects of another class type.

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

A)True

B)False

Q5) Inheritance is an example of a(n)____ relationship.

A) is-a B) has-a C) handshaking

D) had-a

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

Page 13

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

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) Variables that are created during program execution are called static variables. A)True

B)False

Q2) Once a class contains one or more pure virtual functions,then that class is called a(n)____________________ class.

Q3) An object of the base class type cannot be passed to a(n)____________________ parameter of the derived class type.

Q4) Consider the following statements: int x;

int &y = x; The second statement declares y to be a(n)____________________ of x.

Q5) The statement that declares board to be an array of six pointers wherein each pointer is of type int is: int ____________________;

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

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

Page 14

Q8) The statement int *p; is equivalent to int * p;,which is also equivalent to the statement ____________________.

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

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) The ____________________ members of a class are local to the class and,therefore,cannot be accessed outside of the class.

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

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

A) int

B) bool

C) char

D) void

Q5) Both parameters of the function to overload the operator << are reference parameters.

A)True

B)False

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

Q7) The operator function that overloads the insertion operator,<<,or the extraction operator,>>,for a class must be a(n)____________________ function of that class.

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

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) If you want to include members in your exception class,you typically include the function ____.

A) that

B) this

C) log

D) what

Q2) A(n)____ is an occurrence of an undesirable situation that can be detected during program execution.

A) error

B) exception

C) mistake

D) bug

Q3) If the catch block with an ellipses (in the heading)is needed,then it should be the first catch block in a sequence of try/catch blocks.

A)True

B)False

Q4) When an exception occurs in a try block,control immediately passes to one of the ____________________ blocks.

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

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

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) The numbering system that the computer uses is called the ____________________ system.

Q2) ____ control structures use a looping structure,such as while,for,or do...while,to repeat a set of statements.

A) Iterative

B) Recursive

C) Procedural

D) Object

Q3) If you execute a(n)____________________ recursive function on a computer,the function executes until the system runs out of memory.

Q4) How many needles are used in the Tower of Hanoi problem?

A) one

B) two

C) three

D) four

Q5) The recursive algorithm must have one or more base cases,and the general solution must eventually be reduced to a(n)____________________.

Q6) A(n)____________________ control structure is used to control the repeated calls in recursion.

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

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) In C++,the dereferencing operator is represented by the ____________________ symbol.

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

Q3) The ____ deallocates the memory occupied by the nodes of a list when the class object goes out of scope.

A) constructor

B) destructor

C) head pointer

D) tail pointer

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

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

Q6) The nodes of a standard ordered list (as constructed in the text)are in ____________________ order.

Q7) The link field of the last node of a linked list is ____.

A) NULL

B) 1

C) n-1

D) n

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

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)* (c + d)is equivalent to which of the following postfix expressions?

A) a b c d - + *

B) a b - c d + *

C) a b - + c d *

D) - + * a b c d

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

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

Q4) Which of the following is a basic operation performed on a queue?

A) push

B) pop

C) isEmptyQueue

D) top

Q5) The ____________________ constructor is called when a stack object is passed as a (value)parameter to a function.

Q6) In the late 1950s,the Australian philosopher and early computer scientist Charles L.Hamblin proposed a scheme in which the operators follow the operands (postfix operators),resulting in the ____________________ notation.

Page 19

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

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) For a list of length n,the bubble sort makes exactly ____________________ key comparisons.

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

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

Q4) The behavior of quick sort is ____ in the worst case and ____ in the average case.

A) O(nlog<sub>2</sub>n), O(nlog<sub>2</sub>n)

B) O(n<sup>2</sup>), O(n)

C) O(nlog<sup>2</sup>n), O(n<sup>2</sup>)

D) O(n<sup>2</sup>), O(nlog<sub>2</sub>n)

Q5) In a bubble sort for list of length n,the first step is to compare elements ____.

A) list[0] and list[n]

B) list[0] and list[n-1]

C) list[0] and list[1]

D) list[n-1] and list[n+1]

Q6) A sequence of branches in a comparison tree is called a(n)____________________.

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

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) The algorithm below describes the nonrecursive ____________________ traversal of a binary tree.

1.current = root;

2.while (current is not NULL or stack is nonempty) if (current is not NULL) { push current onto stack; current = current->lLink; } else

{ current = stack.top(); pop stack; visit current; //visit the node current = current->rLink;//move to right child }

Q2) The listing of the nodes produced by the preorder traversal of a binary tree is called the ____________________.

Q3) The ____________________ of a path in a binary tree is the number of branches on that path.

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

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) A(n)____________________ ordering of the vertices of the accompanying graph is 0,1,4,3,2,5,7,8,6,9.

Q2) A graph G is a pair,G = (V,E),where V is a finite nonempty set called the set of ____ of G,and the elements of E are the pairs of elements of V.

A) nodes

B) branches

C) vertices

D) edges

Q3) Let G be an undirected graph.Let u and v be two vertices in G.Then u and v are called ____ if there is an edge from one to the other.

A) adjacent

B) weighted

C) connected

D) shortest path

Q4) The depth first traversal is similar to the postorder traversal of a binary tree. A)True

B)False

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

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

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) ____ is a nonmodifying algorithm.

A) equal

B) copy

C) fill

D) sort

Q2) Elements in a(n)____ container are automatically sorted according to some ordering criteria.

A) sequence

B) associative

C) sorted

D) adapter

Q3) The ____________________ iterators are used to output data from a program into an output stream.

Q4) ____ is a sequence container.

A) vector

B) stack

C) queue

D) set

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

Q6) The term ____________________ stands for double-ended queue.

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
Advanced C++ Programming Exam Questions - 1050 Verified Questions by Quizplus - Issuu