Advanced C++ Programming Solved Exam Questions
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
management strategies, and interfacing with hardware or external libraries. The course
emphasizes writing efficient, scalable, and maintainable C++ code through hands-on
Recommended Textbook
C++ Programming Program Design Including Data Structures 6th Edition by D.S. Malik
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
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
Q3) The ____________________ type is C++ 's method for allowing programmers
to create their own simple data types.
Answer: enumeration
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) &
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
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
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
To view all questions and flashcards with answers, click on the resource link above.
Page 8
Chapter 7: User-Defined Simple Data Types, Namespaces,
Sample Questions
Q1) The ____ function is used to interchange the contents of two string variables.
A) iterator
B) traverse
C) swap
D) change
Q3) Suppose str = "abcd"; After the statement str[1] = 'A'; The value of str 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';
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 ____________________.
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 ____________________.
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
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
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
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
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
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;
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);
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.
Q6) Every call to a recursive function requires the system to allocate memory for the
local variables and formal parameters.
A)True
B)False
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 ____________________.
Q6) The nodes of a standard ordered list (as constructed in the text)are in
____________________ order.
Sample Questions
Q1) The ____________________ constructor is called when a stack object is passed
as a (value)parameter to a function.
Q4) Postfix notation requires the use of parentheses to enforce operator precedence.
A)True
B)False
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)____________________.
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
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
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