0% found this document useful (0 votes)
16 views24 pages

Advanced Programming With C++ MCQ PDF

The document provides an overview of an Advanced Programming with C++ course, covering essential topics such as object-oriented design, advanced data structures, templates, and memory management. It includes 21 chapters with 1050 verified questions and flashcards to aid in learning. The course aims to equip participants with the skills to design and implement complex C++ applications efficiently.

Uploaded by

qveepgxjae
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)
16 views24 pages

Advanced Programming With C++ MCQ PDF

The document provides an overview of an Advanced Programming with C++ course, covering essential topics such as object-oriented design, advanced data structures, templates, and memory management. It includes 21 chapters with 1050 verified questions and flashcards to aid in learning. The course aims to equip participants with the skills to design and implement complex C++ applications efficiently.

Uploaded by

qveepgxjae
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 Programming with

C++ MCQ PDF

[Link]
21 Chapters
1050 Verified Questions
Advanced Programming with C++
MCQ PDF
Cou
Advanced Programming with C++ delves into sophisticated concepts and practices

essential for mastering C++ as a powerful programming language. The course covers

object-oriented design, advanced data structures, templates, exception handling,

operator overloading, and polymorphism. Emphasis is placed on memory management,

including pointers, dynamic allocation, and smart pointers, as well as the Standard

Template Library (STL) for efficient coding. Students will also explore multi-threading, file

handling, and best practices for large-scale software development. By the end of the

course, participants will be equipped to design and implement complex C++

applications with clean, efficient, and maintainable code.

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: [Link]

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: [Link]

Sample Questions
Q1) Main memory is called ____.
A) read only memory
B) random access memory
C) read and write memory
D) random read only memory
Answer: B

Q2) The term ____________________ is used to describe a program that has been
written in a high-level language.
Answer: source program
source code
source

Q3) The ____________________ monitors the overall activity of the computer and
provides services such as memory management,input/output activities,and storage
management.
Answer: operating system
OS

Q4) A sequence of 0s and 1s is sometimes referred to as ____________________


code.
Answer: binary
Page 3

Q5) The ASCII data set consists of ____________________ characters.


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

Page 4
Chapter 2: Basic Elements of C++
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]

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

Q2) A mixed arithmetic expression contains all operands of the same type.
A)True
B)False
Answer: False

Q3) The length of the string "computer science" is ____.


A) 14
B) 15
C) 16
D) 18
Answer: C

Q4) Suppose that sum is an int [Link] statement sum += 7; is equivalent to the
statement sum = sum + 7;
A)True
B)False
Answer: True

Q5) A(n)____________________ is a memory location whose contents can be


changed.
Answer: variable Page 5

To view all questions and flashcards with answers, click on the resource link above.
Chapter 3: Input/Output
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]

Sample Questions
Q1) The number of input data extracted by cin and >> depends on the number of
variables appearing in the cin statement.
A)True
B)False
Answer: True

Q2) What is the output of the following statements?


cout << "123456789012345678901234567890" << endl
Cout << setfill('#')<< setw(10)<< "Mickey"
<< setfill(' ')<< setw(10)<< "Donald"
<< setfill('*')<< setw(10)<< "Goofy" << endl;
A) 123456789012345678901234567890
####Mickey Donald*****Goofy
B) 123456789012345678901234567890
####Mickey####Donald*****Goofy
C) 123456789012345678901234567890
####Mickey####Donald#####Goofy
D) 23456789012345678901234567890
****Mickey####Donald#####Goofy
Answer: A

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

Page 6
Chapter 4: Control Structures I (Selection)
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]

Sample Questions
Q1) What does <= mean?
A) less than
B) greater than
C) less than or equal to
D) greater than or equal to

Q2) Which of the following will cause a logical error if you are attempting to compare x to
5?
A) if (x == 5)
B) if (x = 5)
C) if (x <= 5)
D) if (x >= 5)

Q3) Which of the following operators has the highest precedence?


A) !
B) *
C) %
D) =

Q4) A control structure alters the normal sequential flow of execution in a program.
A)True
B)False

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


Page 7
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: [Link]

Sample Questions
Q1) What is the output of the following C++ code? int j;
For (j = 10; j <= 10; j++)
\(\quad\)Cout << j << " ";
Cout << j << endl;
A) 10
B) 10 10
C) 10 11
D) 11 11

Q2) If a(n)____________________ statement is placed in a do...while structure,the


loop-continue test is evaluated immediately after this statement.

Q3) When a continue statement is executed in a ____,the update statement always


executes.
A) while loop
B) for loop
C) switch structure
D) do...while loop

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

Q5) In a while and for loop,the loop condition is evaluated before executing the body of
the [Link],while and for loops are called ____________________ loops.

To view all questions and flashcards with Page


answers,
8 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: [Link]

Sample Questions
Q1) A variable for which memory remains allocated as long as the program executes is
called a(n)____________________ variable.

Q2) Which of the following function prototypes is valid?


A) int funcExp(int x, float v);
B) funcExp(int x, float v){};
C) funcExp(void);
D) int funcExp(x);

Q3) A(n)____________________ parameter s a formal parameter that receives a


copy of the content of the corresponding actual parameter.

Q4) The heading of the function is also called the ____.


A) title
B) function signature
C) function head
D) function header

Q5) ____________________ parameters are useful in three situations:


• When the value of the actual parameter needs to be changed
• When you want to return more than one value from a function
• When passing the address would save memory space and time relative to copying a
large amount of data

To view all questions and flashcards with Page


answers,
9 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: [Link]

Sample Questions
Q1) An enumeration type can be passed as a parameter to a function only by value.
A)True
B)False

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


A)True
B)False

Q3) Consider the declaration: enum sports


{BASKETBALL,FOOTBALL,HOCKEY,BASEBALL,SOCCER};
Which of the following statements is true?
A) SOCCER-- = BASEBALL
B) BASEBALL++ = SOCCER
C) HOCKEY + FOOTBALL < SOCCER
D) FOOTBALL <= SOCCER

Q4) The data type string has a named constant,____,associated with it.
A) string::size
B) string::size_type
C) string::pos
D) string::npos

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

To view all questions and flashcards with answers, click on the resource link above.
Chapter 8: Arrays and Strings
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]

Sample Questions
Q1) The array index can be any integer less than the array size.
A)True
B)False

Q2) Suppose that list is an array of 10 components of type [Link] of the following
codes correctly outputs all the elements of list?
A) for (int j = 1; j < 10; j++)
\(\quad\)\(\quad\)cout << list[j] << " ";
\(\quad\)cout << endl;
B) for (int j = 0; j <= 9; j++)
\(\quad\)\(\quad\)Cout << list[j] << " ";
\(\quad\)cout << endl;
C) for (int j = 1; j < 11; j++)
\(\quad\)\(\quad\)cout << list[j] << " ";
\(\quad\)cout << endl;
D) for (int j = 1; j <= 10; j++)
\(\quad\)\(\quad\)cout << list[j] << " ";
\(\quad\)cout << endl;

Q3) The following statement creates alpha to be a two-dimensional array with


____________________ rows.
int alpha[10][25];

To view all questions and flashcards with answers, click on the resource link above.
Page 11
Chapter 9: Records (structs)
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]

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 correctly initializes the component length of bigRect?
A) bigRect = {10};
B) [Link] = 10;
C) length[0]= 10;
D) bigRect[0]= 10

Q2) Consider the accompanying struct [Link] statement that assigns the
average of testScore and programmingScore to score is ____________________.

Q3) Both arrays and structs are examples of ____________________ data types.

Q4) You can declare struct variables when you define a struct.
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
50 Verified Questions
50 Flashcards
Source URL: [Link]

Sample Questions
Q1) Consider the accompanying class definition in Figure [Link] of the following
variable declarations is correct?
A) rectangle rectangleType;
B) class rectangleType rectangle;
C) rectangleType rectangle;
D) rectangle [Link];

Q2) What does ADT stand for?


A) abstract definition type
B) asynchronous data transfer
C) abstract data type
D) alternative definition type

Q3) A program or software that uses and manipulates the objects of a class is called
a(n)____________________ of that class.

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

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: [Link]

Sample Questions
Q1) If the corresponding functions in the base class and the derived class have the same
name but different sets of parameters,then this function is ____ in the derived class.
A) reused
B) redefined
C) overloaded
D) overridden

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


programming,we debug functions.

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

Q4) OOP implements ____.


A) UML
B) IPE
C) EIP
D) OOD

Q5) To define new classes in C++,you create new ____________________ files.

Q6) If inheritance is public,all protected members of the base class are


____________________ members of the derived class.

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

Page 14
Q8) Objects are created when ____________________ variables are declared.

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: [Link]

Sample Questions
Q1) The binding of virtual functions occurs at program ____________________
time.

Q2) A list is a collection of elements of the same type.


A)True
B)False

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

Q4) If p is a pointer variable,the statement p = p + 1; is valid in C++.


A)True
B)False

Q5) Given the declaration


int *p;
The statement
p = new int[50];
dynamically allocates an array of 50 components of type int and p contains the base
address of the array.
A)True
B)False
Page 15
Q6) An object of the base class type cannot be passed to
a(n)____________________ parameter of the derived class type.

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: [Link]

Sample Questions
Q1) Which of the following is the general syntax of the function prototype to overload the
post-increment operator as a member function?
A) className operator++();
B) friend className operator++();
C) className operator++(int);
D) friend className operator++(int);

Q2) The name of the function to overload the operator <= is ____.
A) overload<=
B) <=new
C) operator<=
D) <=operator

Q3) If you overload the binary arithmetic operator + as a member function,how many
objects must be passed as parameters?
A) none
B) one
C) two
D) three

Q4) The ____________________ operator function as a member of a class has only


one parameter; as a nonmember of a class,it has two parameters.

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: [Link]

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) Which of the following statements creates a new exception class?


A) class myClass {};
B) class myClass {} implements exception;
C) class myExceptionClass {} extends exception;
D) class myExceptionClass {} throws exception;

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


A)True
B)False

Q4) The class ____________________ deals with the string subscript out of range
error.

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

Q6) In C++,throw is a(n)____________________


Page 17 word.

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: [Link]

Sample Questions
Q1) The numbering system that the computer uses is called the
____________________ system.

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) If you execute a(n)____________________ recursive function on a


computer,the function executes until the system runs out of memory.

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: [Link]

Sample Questions
Q1) Which of the following is a basic operation on singly linked lists?
A) Retrieve the data of an arbitrary node.
B) Swap the head and the last nodes.
C) Determine whether the list is full.
D) Make a copy of the linked list.

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

Q3) Consider the accompanying [Link] 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

Q4) It is not possible to create an ordered linked list.


A)True
B)False

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

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

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: [Link]

Sample Questions
Q1) A queue is a First In First Out data structure.
A)True
B)False

Q2) You can perform the add operation,called ____,to add an element onto the stack.
A) pop
B) push
C) enqueue
D) dequeue

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


A) push
B) pop
C) isEmptyQueue
D) top

Q4) The infix expression


(a + b)* (c - d / e)+ f
is equivalent to the postfix expression
ab + cde /-* f +
A)True
B)False

Q5) An array is a(n)____________________ access data structure.


Page 20
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: [Link]

Sample Questions
Q1) In the case of an unsuccessful search,it can be shown that for a list of length n,a
binary search makes approximately ____________________ key comparisons.

Q2) Assume that list consists of the following [Link] is the result after bubble
sort completes? int list[] = {2,56,34,25,73,46,89,10,5,16};
A) 89 73 56 46 34 25 16 10 5 2
B) 2 56 34 25 5 16 89 46 73
C) 2 5 10 16 25 34 46 56 73 89
D) 2 10 16 25 34 46 56 73 89

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

Q4) After the second iteration of bubble sort for a list of length n,the last ____ elements
are sorted.
A) two
B) three
C) n-2
D) n

Q5) A sequence of branches in a comparison tree is called


a(n)____________________.

Q6) The top node of a comparison tree is call the ____________________ node.

Page 21
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: [Link]

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

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

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


branches on that path.

Q4) The sequence of operations in a postorder traversal is ____.


A) traverse left; traverse right
B) traverse left; traverse right; visit
C) visit; traverse left; traverse right
D) traverse left; visit; traverse right

Q5) The ____________________ of a binary tree is the number of nodes on the


longest path from the root to a leaf.

To view all questions and flashcards withPage


answers,
22 click on the resource link above.
Chapter 20: Graphs
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: [Link]

Sample Questions
Q1) A graph is ____________________ if the number of vertices is zero.

Q2) In Prim's algorithm for the minimal spanning tree,we start at a designated
vertex,which we call the ____ vertex.
A) index
B) source
C) root
D) destination

Q3) The shortest path algorithm was developed by ____.


A) Euler
B) Kruskal
C) Prim
D) Dijkstra

Q4) A(n)____________________ ordering of the vertices of the accompanying


graph is 0,1,3,4,2,5,7,8,6,9.

Q5) A binary tree has no cycles.


A)True
B)False

Q6) ____________________ algorithm builds the tree iteratively by adding edges


until a minimal spanning tree is obtained.

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: [Link]

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

Q2) The class ____ contains the definition of an output stream iterator.
A) iostream
B) iostream_iterator
C) ostream
D) ostream_iterator

Q3) Elements in a(n)____ container are automatically sorted according to some


ordering criteria.
A) sequence
B) associative
C) sorted
D) adapter

Q4) The operator ____________________,supported by the stack container


class,inserts a copy of item onto the stack.

Q5) The [Link]()operation on a deque object checks whether the container is empty.
A)True
B)False

Q6) List containers are implemented as doubly ____________________.

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

You might also like