0% found this document useful (0 votes)
48 views

Module: C++ & Data Structures Using C++ Session No. 1 Q. No. 1

This document contains 22 multiple choice questions across 22 sessions about data structures and algorithms. The questions cover topics such as classes, inheritance, operator overloading, file input/output, templates, stacks, queues, linked lists, trees, graphs, sorting algorithms, complexity analysis, and algorithm efficiency. The difficulty levels range from easy to difficult.

Uploaded by

Pranav Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Module: C++ & Data Structures Using C++ Session No. 1 Q. No. 1

This document contains 22 multiple choice questions across 22 sessions about data structures and algorithms. The questions cover topics such as classes, inheritance, operator overloading, file input/output, templates, stacks, queues, linked lists, trees, graphs, sorting algorithms, complexity analysis, and algorithm efficiency. The difficulty levels range from easy to difficult.

Uploaded by

Pranav Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Module: C++ & Data Structures Using C++

Session No. 1
Q. No. 1

What does your class can hold?

A. data
B.  functions
C. both a & b
D. none of the mentioned

Difficulty Level: Easy

Q. No. 2

 Which other keywords are also used to declare the class other than class?

A. struct
B. union
C. object
D. both a & b

Difficulty Level: Intermediate

Session No. 2
Q. No. 3

The fields in the class in c++ program are by default

A. protected
B. private
C. public
D. None of the mentioned

Difficulty Level: Easy

Q. No. 4

. When struct is used instead of the keyword class means, what will happen in the program?

A. access is public by default.


B. access is private by default.
C. access is protected by default.
D.  none of the mentioned.
Difficulty Level: Intermediate

Session No. 3

Q. No. 5

Pick the other name of operator function.

A. function overloading
B. operator overloading
C. member overloading
D. None of the mentioned

Difficulty Level: Easy

Q. No. 6

Which of the following statements is NOT valid about operator overloading?

A. Only existing operators can be overloaded.


B. Overloaded operator must have at least one operand of its class type.
C. The overloaded operators follow the syntax rules of the original operator.
D. None of the mentioned

Difficulty Level: Intermediate

Session No. 4

Q. No. 7

 Pick out the correct statement.

A.  A derived class’s constructor cannot explicitly invokes its base class’s


constructor.
B.  A derived class’s destructor cannot invoke its base class’s destructor.
C. A derived class’s destructor can invoke its base class’s destructor.
D. None of the mentioned

Difficulty Level: Intermediate

Q. No. 8
Which constructor will initialize the base class data member?

A. derived class
B. base class
C. class
D. None of the mentioned

Difficulty Level: Intermediate

Session No. 5

Q. No. 9

What is meant by containership?

A. class contains objects of other class types as its members


B. class contains objects of other class types as its objects
C.  both a & b
D. none of the mentioned

Difficulty Level: Intermediate

Q. No. 10

What does derived class does not inherit from the base class?
A. constructor and destructor
B. friends
C. operator = () members
D.  all of the mentioned

Difficulty Level: Intermediate

Session No. 6

Q. No. 11

 To which does the function pointer point to?


A. variable
B. constants
C. function
D. absolute variables

Difficulty Level: Intermediate

Q. No. 12

What we will not do with function pointers?

A. allocation of memory
B. de-allocation of memory
C.  both a & b
D. none of the mentioned

Difficulty Level: easy

Session No. 7

Q. No. 13

 Which header file is used for reading and writing to a file?

A. #include<iostream>
B. #include<fstream>
C. #include<file>
D. None of the mentioned

Difficulty Level: Easy

Q. No. 14
Which member function is used to determine whether the stream object is currently
associated with a file?

 
A. is_open
B. buf
C. string
D. None of the mentioned

Difficulty Level: Easy


Session No. 8

Q. No. 15

Which is dependent on template parameter?

A. base class
B. abstract class
C. method
D. None of the mentioned

Difficulty Level: Intermediate

Q. No. 16

From where does the template class derived?

A. regular non-templated C++ class


B. templated class
C. a or b
D. none of the mentioned

Difficulty Level: Intermediate


Session No. 9

Q. No. 17

In a heap, element with the greatest key is always in the ___________ node

A. leaf
B. root
C. first node of left sub tree
D. first node of right sub tree

Difficulty Level: easy

Q. No. 18

Which of the following name does not relate to stacks?


A. FIFO lists
B. LIFO list
C. Piles
D.  Push-down lists

Difficulty Level: easy

Session No. 10

Q. No. 19

A data structure where elements can be added or removed at either end but not in the middle

A. Linked lists
B. Stacks
C.  Queues
D. Deque

Difficulty Level: Intermediate

Q. No. 20

The situation when in a linked list START=NULL is

A. underflow
B. overflow.
C. housefull.
D. saturated

Difficulty Level: Intermediate

Session No. 11

Q. No. 21

The difference between linear array and a record is

A.  An array is suitable for homogeneous data but hte data items in a record may have different
data type.
B.  In a record, there may not be a natural ordering in opposed to linear array .
C. A record form a hierarchical structure but a lienear array does not
D.  All of above
Difficulty Level: Intermediate

Q. No. 22

 When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal would return
A. FAEKCDBHG
B. FAEKCDHGB
C. EAFKHDCBG
D. FEAKDCHBG

Difficulty Level: Intermediate

Session No. 12

Q. No. 23

Which of the following data structure is linear data structure?

A. Trees
B. Graphs
C. Arrays
D. None of above

Difficulty Level: Intermediate

Q. No. 24

In a circular linked list

A. Components are all linked together in some sequential manner.


B. There is no beginning and no end.
C. Components are arranged hierarchically.
D. Forward and backward traversal within the list is permitted.

Difficulty Level: Intermediate

Session No. 13
Q. No. 25

The height of a BST is given as h. Consider the height of the tree as the no. of edges in the longest
path from root to the leaf. The maximum no. of nodes possible in the tree is?

E. 2h-1 -1
F. 2h+1 -1
G. 2h +1
H. 2h-1 +1

Difficulty Level: Intermediate

Q. No. 26

The no of external nodes in a full binary tree with n internal nodes is?

A. n .
B. n+1.
C. 2n.
D. 2n + 1

Difficulty Level: Intermediate

Session No. 14

Q. No. 27

Consider an undirected graph G with 100 nodes. The maximum number of edges to be included in G
so that the graph is not connected is

A. 2451
B. 4950
C. 4851
D. 9900

Difficulty Level: Intermediate

Q. No. 28

The amortized time complexity to perform ______ operation(s) in Splay trees is O(Ig n).

A. Search
B. Search & Insert
C. Search & Delete
D. Search,Insert & Delete

Difficulty Level: Intermediate

Session No. 15

Q. No. 29

The min. number of nodes in a binary tree of depth d (root at level 0) is

E. 2d − 1
F. 2d + 1 − 1
G. d+1
H. d

Difficulty Level: Difficult

Q. No. 30

The efficient data structure to insert/delete a number in a stored set of numbers is

A. Queue
B. Linked list
C. Doubly linked list
D. Binary tree

Session No. 16

Q. No. 31

Which of the following is not a stable sorting algorithm?

A. Insertion sort
B. Selection sort
C. Bubble sort
D. Merge sort

Difficulty Level: Difficult

Q. No. 32

Which of the following is not an in-place sorting algorithm?

A. Selection sort
B. Heap sort
C. Quick sort
D. Merge sort

Difficulty Level: Intermediate

Session No. 17

Q. No. 33

Running merge sort on an array of size n which is already sorted is

A. O(n)
B. O(nlogn)
C. O(n2)
D. None

Difficulty Level: Difficult

Q. No. 34

The time complexity of a quick sort algorithm which makes use of median, found by an O(n)
algorithm, as pivot element is

A. O(n2)
B. O(nlogn)
C. O(nloglogn)
D. Merge sort

Difficulty Level: Intermediate

Session No. 18

Q. No. 35

Which of the following is not a non comparison sort?

A. Counting sort
B. Bucket sort
C. Radix sort
D. Shell sort

Difficulty Level: Difficult


Q. No. 36

The time complexity of heap sort in worst case is

A. O(logn)
B. O(n)
C. O(nlogn)
D. O(n2)

Difficulty Level: Intermediate

Session No. 19

Q. No. 37

Two main measures for the efficiency of an algorithm are


A. Processor and memory
B. Complexity and capacity
C. Time and space
D. Data and space

Difficulty Level: Difficult

Q. No. 38

The time factor when determining the efficiency of algorithm is measured by

A. Counting microseconds 
B. Counting the number of key operations
C. Counting the number of statements
D. Counting the kilobytes of algorithm

Difficulty Level: Intermediate

Session No. 20

Q. No. 39

The space factor when determining the efficiency of algorithm is measured by


E.  Counting the maximum memory needed by the algorithm
F. Counting the minimum memory needed by the algorithm
G. Counting the average memory needed by the algorithm
H. Counting the maximum disk space needed by the algorithm

Difficulty Level: Difficult

Q. No. 40

Which of the following case does not exist in complexity theory

E. Best case
F. Worst case
G. Average case
H. Null case

Difficulty Level: Intermediate

Session No. 21

Q. No. 41

The complexity of the average case of an algorithm is


I. Much more complicated to analyze than that of worst case
J. Much more simpler to analyze than that of worst case
K. Sometimes more complicated and some other times simpler than that of worst case 
L. None or above

Difficulty Level: Difficult

Q. No. 42

The indirect change of the values of a variable in one module by another module is called

A. internal change
B. inter-module change
C. side effect
D. side-module update

Difficulty Level: Intermediate

Session No. 22
Q. No. 43

Algorithms may be stated in an operation specification for which of the following reasons?

A. An algorithm may be stated to provide a procedural specification of the operation’s behavior


B. An algorithm may be stated to specify that the algorithm is to be used in the implementation
C. All of the mentioned 
D. None of the mentioned

Difficulty Level: Difficult

Q. No. 44

Data structures generally employ which of the following implementation strategies?

A. Contiguous Implementation
B. Linked Implementation
C. All of the mentioned
D. None of the mentioned

Difficulty Level: Intermediate

Total No of Question : 44

You might also like