0% found this document useful (0 votes)
32 views25 pages

Advanced C++ Programming Solved Exam Questions

The document outlines an Advanced C++ Programming course that covers complex programming topics such as template metaprogramming, multithreading, and memory management. It includes 21 chapters with a total of 1050 verified questions and flashcards for study resources. The course aims to equip students with the skills to write efficient and maintainable C++ code for modern applications.

Uploaded by

tb41lujmji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views25 pages

Advanced C++ Programming Solved Exam Questions

The document outlines an Advanced C++ Programming course that covers complex programming topics such as template metaprogramming, multithreading, and memory management. It includes 21 chapters with a total of 1050 verified questions and flashcards for study resources. The course aims to equip students with the skills to write efficient and maintainable C++ code for modern applications.

Uploaded by

tb41lujmji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Advanced C++ Programming

Solved Exam Questions

https://quizplus.com/study-set/319
21 Chapters
1050 Verified Questions
Advanced C++ Programming
Solved Exam Questions
Course Introduction
Advanced C++ Programming delves into sophisticated programming concepts and

practices that extend beyond the basics of C++. Topics covered include template

metaprogramming, advanced use of the Standard Template Library (STL),

object-oriented design patterns, multithreading and concurrency, memory

management strategies, and interfacing with hardware or external libraries. The course

emphasizes writing efficient, scalable, and maintainable C++ code through hands-on

projects and collaborative problem-solving. By the end, students will be equipped to

tackle complex software development challenges and contribute to modern C++

applications in both academic and professional settings.

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) Consider the following C++ program. #include <iostream>
Using namespace std;
Int main()
{
\(\quad\)Cout << "Hello World "
\(\quad\)Return 0;
}
In the cout statement,the missing semicolon in the code above will be caught by the
____.
A) compiler
B) editor
C) assembler
D) control unit
Answer: A

Q2) Main memory is directly connected to the CPU.


A)True
B)False
Answer: True

Q3) The ASCII data set consists of ____________________ characters.


Answer: 128 Page 3

To view all questions and flashcards with answers, click on the resource link above.
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) ____________________ can be used to identify the authors of the program,give
the date when the program is written or modified,give a brief explanation of the
program,and explain the meaning of key statements in a program.
Answer: Comments
comments

Q2) An example of a floating point data type is ____.


A) int
B) char
C) double
D) short
Answer: C

Q3) The ____________________ type is C++ 's method for allowing programmers
to create their own simple data types.
Answer: enumeration

Q4) ____________________ is the process of planning and creating a program.


Answer: Programming
programming

Q5) The memory space for a(n)____________________ data value is 64 bytes.


Answer: long long

To view all questions and flashcards with Page 4 click on the resource link above.
answers,
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) The following statements will result in input failure if the input values are not on a
separate line.(Assume that x and y are int variables.)
cin >> x;
cin >> y;
A)True
B)False
Answer: False

Q2) Suppose that x and y are int variables,z is a double variable,and the input is: 28 32.6
12
Choose the values of x,y,and z after the following statement executes:
Cin >> x >> y >> z;
A) x = 28, y = 32, z = 0.6
B) x = 28, y = 32, z = 12.0
C) x = 28, y = 12, z = 32.6
D) x = 28, y = 12, z = 0.6
Answer: A

Q3) The stream function ____________________ lets you put the last character
extracted from the input stream by the get function back into the input stream.
Answer: putback

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 the "not equal to" relational operator?
A) !
B) |
C) !=
D) &

Q2) What does <= mean?


A) less than
B) greater than
C) less than or equal to
D) greater than or equal to

Q3) Putting a semicolon after the parentheses following the expression in an if statement
(that is,before the statement)is a(n)____________________ error.

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

Q5) In C++,the logical operator AND is represented by ____________________.

To view all questions and flashcards with Page 6 click on the resource link above.
answers,
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 the case of the sentinel-controlled while loop,the first item is read before the while
loop is entered.
A)True
B)False

Q2) Which of the following loops is guaranteed to execute at least once?


A) counter-controlled while loop
B) for loop
C) do...while loop
D) sentinel-controlled while loop

Q3) The ____________________ statement is typically used for two purposes:


• To exit early from a loop.
• To skip the remainder of a switch structure.

Q4) A loop ____________________ is a set of statements that remains true each


time the loop body is executed.

Q5) The ____ statement can be used to eliminate the use of certain (flag)variables.
A) while
B) switch
C) break
D) if

Pagetype
Q6) The function eof is a member of the data 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) What value is returned by the following return statement? int x = 5;
Return x + 1;
A) 0
B) 5
C) 6
D) 7

Q2) If a formal parameter is a nonconstant reference parameter,during a function call,its


corresponding actual parameter must be a(n)____________________.

Q3) Given the following function prototype: double tryMe(double,double);,which of the


following statements is valid? Assume that all variables are properly declared.
A) cin >> tryMe(x);
B) cout << tryMe(2.0, 3.0);
C) cout << tryMe(tryMe(double, double), double);
D) cout << tryMe(tryMe(float, float), float);

Q4) The statement: return 37,y,2 * 3; returns the value ____.


A) 2
B) 3
C) y
D) 6

To view all questions and flashcards with answers, click on the resource link above.
Page 8
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) The ____ function is used to interchange the contents of two string variables.
A) iterator
B) traverse
C) swap
D) change

Q2) In C++,[] is called the array subscript operator.


A)True
B)False

Q3) Suppose str = "abcd"; After the statement str[1] = 'A'; The value of str is
"____________________".

Q4) An enumeration type can be passed as a parameter to a function only by value.


A)True
B)False

Q5) The data type string has a named


constant,____________________,associated with it.

Q6) A function cannot return the value of an enumeration type.


A)True
B)False Page 9

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


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

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

Sample Questions
Q1) Consider the following statement: double alpha[10][5];.The number of components
of alpha is ____.
A) 15
B) 50
C) 100
D) 150

Q2) Assume you have the following declaration int beta[50];.Which of the following is a
valid element of beta?
A) beta['2']
B) beta['50']
C) beta[0]
D) beta[50]

Q3) Which of the following correctly declares name to be a character array and stores
"William" in it?
A) char name[6] = "William";
B) char name[7] = "William";
C) char name[8] = "William";
D) char name[8] = 'William';

Q4) The function ____________________ returns the length of the string


s,excluding the null character.

Page 11
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/5312

Sample Questions
Q1) You can declare struct variables when you define a struct.
A)True
B)False

Q2) Consider the accompanying struct definition in Figure 1.The statement that initializes
the member testScore to 95 is ____________________.

Q3) Aggregate input/output operations are allowed on a struct variable.


A)True
B)False

Q4) Typically,in a program,a struct is defined ____ in the program.


A) in the main function
B) before the definitions of all the functions
C) after the definitions of all the functions
D) in any function

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

Q6) Consider the accompanying struct definition.The statement that assigns the
average of testScore and programmingScore to score is ____________________.

Q7) A(n)____________________ is a set of elements of the same type.

Page 12
Q8) In C++,struct is a(n)____________________ word.

To view all questions and flashcards with answers, click on the resource link above.
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) Non-static member variables of a class are called the ____________________
variables of the class.

Q2) The components of a class are called the ____ of the class.
A) elements
B) members
C) objects
D) properties

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

Q4) Consider the accompanying class definition,and the declaration: rectangleType


bigRect;
Which of the following statements is correct?
A) rectangleType.print();
B) rectangl
C) bigRect.print();
D) bigRect::print();

Page 13
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 can directly access the protected members of the base class.
A)True
B)False

Q2) The ____ members of an object form its internal state.


A) private
B) protected
C) public
D) static

Q3) In object-oriented design,we debug ____________________; in structured


programming,we debug functions.

Q4) The private members of a base class can be directly accessed by a derived class.
A)True
B)False

Q5) A call to the base class's constructor is specified in the heading of the definition of a
derived class constructor.
A)True
B)False

Q6) In OOD,a program is a collection of interacting ____________________; in


structured programming,a program is a collection of interacting functions.
Page 14
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) A memory leak is an unused memory space that cannot be allocated.
A)True
B)False

Q2) In C++,pointer variables are declared using the reserved word pointer.
A)True
B)False

Q3) The ____ operator can be used to return the address of a private data member of a
class.
A) dereferencing
B) destructor
C) address of
D) member access

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


A) dynamic
B) new
C) virtual
D) dereferencing

Q5) In C++,the dot operator has a lower precedence than the dereferencing operator.
Page 15
A)True
B)False

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) Which of the following is a built-in operation on classes?
A) increment
B) assignment
C) decrement
D) relational

Q2) The only built-in operations on classes are assignment (=)and


____________________.

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

Q4) Which of the following is the syntax to overload the operator function operator[] as a
member function of a class for constant arrays?
A) const Type& []operator(int index) const;
B) const Type& operator[](int index) const;
C) const Type& operator[](int index);
D) const Type [](int index) const;

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


A)True
B)False

Q6) Except for the ____________________ operator and the member selection
operator,to use an operator on class objects,that operator must be overloaded.
Page 16
To view all questions and flashcards with answers, click on the resource link above.
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) 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 can do the following:


____________________; partially process the exception and throw the same
exception or a new exception; or throw a new exception.

Q3) Which of the following options should you choose when an exception occurs in the
program that analyzes an airline's ticketing transactions?
A) Terminate the program.
B) Include code in the program to recover from the exception.
C) Log the error and continue.
D) Include code in the header file.

Q4) The ____________________ of the catch block parameter specifies the type of
exception that the catch block can catch.

Q5) The code to handle exceptions depends on the type of application you develop.
A)True
B)False

To view all questions and flashcards withPage 17 click on the resource link above.
answers,
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 ____________________ bit of 33 is 1.

Q2) Tracing through ____ recursion is more tedious than tracing other recursive forms.
A) direct
B) indirect
C) tail
D) iterative

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

Q4) Infinite recursions execute forever on a computer.


A)True
B)False

Q5) The fourth Fibonacci number in a sequence is the sum of the


____________________ Fibonacci numbers.

Q6) Every call to a recursive function requires the system to allocate memory for the
local variables and formal parameters.
A)True
B)False

Q7) Recursive algorithms are implemented using ____________________


functions. Page 18

Q8) The collating sequence of A in the ASCII character set is


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

Page 19
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 a circular linked list with more than one node,it is convenient to make the pointer
first point to the ____________________ node of the list.

Q2) When you build a linked list in the backward manner,a new node is always inserted
at the end of the linked list.
A)True
B)False

Q3) When building a linked list in the ____ manner,a new node is always inserted at the
end of the linked list.
A) backward
B) forward
C) traversal
D) random

Q4) For classes that include pointer data members,the assignment operator must be
explicitly ____________________.

Q5) In C++,the dereferencing operator is represented by the


____________________ symbol.

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

To view all questions and flashcards withPage


answers,
20 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 ____________________ constructor is called when a stack object is passed
as a (value)parameter to a function.

Q2) In a queuing system,we use a(n)____________________ variable to set the


status of the server.

Q3) The postfix expression 14 2 5 + = will generate an error,because ____.


A) it contains an illegal operator
B) it does not have enough operands
C) it has too many operators
D) there will be too many elements in the stack when the equal sign is encountered

Q4) Postfix notation requires the use of parentheses to enforce operator precedence.
A)True
B)False

Q5) A(n)____________________ system consists of servers and queues of objects


waiting to be served.

Q6) You can perform the add operation,called ____,to add an element onto the stack.
A) pop
B) push
C) enqueue
D) dequeue
Page 21
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) The quick sort algorithm uses the ____________________ technique to sort a
list.

Q2) A sequential search of an n-element list takes ____ key comparisons on average to
determine whether the search item is in the list.
A) 0
B) n/2
C) n
D) n<sup>2</sup>

Q3) To construct a search algorithm of the order less than log<sub>2</sub>n,it cannot
be ____________________ based.

Q4) A sequential search of an n-element list takes ____ key comparisons if the item is
not in the list.
A) 0
B) n/2
C) n
D) n<sup>2</sup>

Q5) In general,the selection sort algorithm is good only for small lists because
____________________ grows rapidly as n grows.

Q6) The top node of a comparison tree is call the ____________________ node.
Page 22
Q7) 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.
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) After inserting an item in a binary search tree,the resulting binary tree must be
a(n)____________________.

Q2) The operations to do inorder,preorder,and postorder traversals of a binary search


tree are the same as those for a binary tree.
A)True
B)False

Q3) The ____________________ of a path in a binary tree is the number of


branches on that path.

Q4) A pointer to the root node of the binary tree is stored outside the binary tree in a
pointer variable,usually called the ____.
A) node
B) parent
C) root
D) nodeType

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


A) relation
B) path
C) directed line
D) directed branch

To view all questions and flashcards withPage 23 click on the resource link above.
answers,
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 simple path is a path in which all vertices,except possibly the first and last
vertices,are distinct.
A)True
B)False

Q2) The ____ of sets A and B is the set of all elements that are in A or in B.
A) intersection
B) union
C) graph
D) reunion

Q3) Graph theory started in 1736 with the ____ problem.


A) Königsberg bridge
B) Tower of Hanoi
C) Westminster
D) League of Augsburg

Q4) A(n)____________________ graph G is called strongly connected if any two


vertices in G are connected.

Q5) In a directed graph,the pairs (u,v)and (v,u)represent the same edge.


A)True
B)False

Pageif 24
Q6) A graph is ____________________ the number of vertices is zero.

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) The term ____________________ stands for double-ended queue.

Q2) In the ____ sort algorithm,the array containing the data is viewed as a binary tree.
A) modifying
B) heap
C) nonmodifying
D) numeric

Q3) If consecutive elements in listCont have the same value,the ____ operation
removes the duplicates.
A) listCont.remove()
B) listCont.duplicate()
C) listCont.remove(duplicate)
D) listCont.unique()

Q4) The deq.front()operation on a deque object checks whether the container is empty.
A)True
B)False

Q5) The name of the class that implements the vector container is container.
A)True
B)False

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

You might also like