# Advanced Data Structures And Algorithm Test! Trivia Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
| By Abhiram
A
Abhiram
Community Contributor
Quizzes Created: 3 | Total Attempts: 863
Questions: 25 | Attempts: 592  Settings  We all know the importance of having access to your data when you need it. It is therefore important to ensure that data is collected and organized accurately; this is achieved in various ways. Test your knowledge of data structure and algorithm by taking the quiz below. Best of luck!

• 1.

### What is reference variable in C++

• A.

Behaves like a pointer variable

• B.

• C.

Can be used for call by reference

• D.

All

D. All
Explanation
A reference variable in C++ behaves like a pointer variable, as it holds the address of another variable. It can be used for call by reference, allowing the referenced variable to be modified within a function. Therefore, the correct answer is "all", as all the given statements accurately describe the characteristics and usage of reference variables in C++.

Rate this question:

• 2.

### A recursive function will be infinite recursive if the following were left out

• A.

Base criteria

• B.

Recursive call

• C.

Loop

• D.

Variable delcaration

A. Base criteria
Explanation
If the base criteria were left out in a recursive function, there would be no condition to stop the recursion. The base criteria is the condition that determines when the recursive function should stop calling itself and return a value. Without this condition, the recursive function would continue to call itself indefinitely, resulting in an infinite recursion.

Rate this question:

• 3.

### Time taken to insert an element in a queue is

• A.

O(log n)

• B.

1

• C.

O(n)

• D.

None

C. O(n)
Explanation
The correct answer is O(n) because in a queue, elements are inserted at the rear end, and to insert an element, we need to traverse through all the existing elements in the queue until we reach the end. Therefore, the time complexity of inserting an element in a queue is directly proportional to the number of elements already present in the queue, which is represented as O(n).

Rate this question:

• 4.

### What are the 3 imp features of OOPS

• A.

Encapsulation,inheritance,polymorphism

• B.

Datahiding,exception handling,templates

• C.

• D.

None

A. Encapsulation,inheritance,polymorphism
Explanation
The three important features of Object-Oriented Programming (OOPS) are encapsulation, inheritance, and polymorphism. Encapsulation refers to the bundling of data and methods together, allowing access to the data only through defined methods. Inheritance enables the creation of new classes by inheriting properties and behaviors from existing classes, promoting code reuse. Polymorphism allows objects of different classes to be treated as objects of a common superclass, providing flexibility and extensibility in programming.

Rate this question:

• 5.

### Time taken to insert in to a linked queue

• A.

O(log2n)

• B.

O(n)

• C.

O(nlog2n)

• D.

O(1)

C. O(nlog2n)
Explanation
The correct answer is O(nlog2n) because the time taken to insert an element into a linked queue is directly proportional to the number of elements already present in the queue. As the number of elements increases, the time taken to insert also increases. Additionally, the logarithmic factor (log2n) suggests that the time complexity grows at a slower rate compared to O(n), but still increases significantly as the size of the queue grows. Therefore, the time complexity for insertion in a linked queue is O(nlog2n).

Rate this question:

• 6.

### An application uses encapsulation to achive

• A.

Information or data hiding

• B.

Minimize independence among modules

• C.

Make implementation independent

• D.

All

D. All
Explanation
Encapsulation in an application refers to the practice of bundling data and methods together within a class, hiding the internal details and providing a public interface for accessing and manipulating the data. This technique achieves information or data hiding by preventing direct access to the internal data, ensuring that it can only be modified through the defined methods. Additionally, encapsulation helps minimize independence among modules by allowing changes to be made to the internal implementation of a class without affecting other parts of the application. It also promotes implementation independence by providing a clear separation between the internal workings of a class and its external usage. Therefore, all of the given options are correct explanations for why an application uses encapsulation.

Rate this question:

• 7.

### OOP allow extension of object function  or class of function.This ability with in OOP is called

• A.

Extendability

• B.

Extension capacity

• C.

Virtual extension

• D.

Scalabilty

D. Scalabilty
Explanation
Scalability refers to the ability of a system or software to handle increasing amounts of work or to accommodate growth. In the context of Object-Oriented Programming (OOP), scalability refers to the ability to easily extend or add new functionality to objects or classes without affecting the existing code. This allows for the development of flexible and adaptable software systems that can easily accommodate changes and expansions in requirements.

Rate this question:

• 8.

### In single linked list we can traverse from back to front

• A.

True

• B.

False

B. False
Explanation
In a single linked list, each node only has a reference to the next node, so it is not possible to traverse from back to front. To traverse a linked list, we start from the head node and follow the next pointers until we reach the end of the list. Therefore, the given statement is false.

Rate this question:

• 9.

### Using Double linked lists we can implement deque

• A.

True

• B.

False

A. True
Explanation
A double linked list is a type of data structure that consists of nodes, where each node contains a reference to the previous and next node in the list. This allows for efficient insertion and deletion of elements at both ends of the list, making it suitable for implementing a deque (double-ended queue). Therefore, the statement that using double linked lists we can implement a deque is true.

Rate this question:

• 10.

### Application of satack is

• A.

BFS

• B.

Railway reservation

• C.

Recursion

• D.

None

C. Recursion
Explanation
The correct answer is recursion. Recursion is a programming technique where a function calls itself to solve a problem by breaking it down into smaller subproblems. It is commonly used in algorithms and data structures to solve complex problems efficiently. In the given options, BFS (breadth-first search) and railway reservation are specific applications or use cases that can make use of recursion, but they are not the general application of recursion. The option "none" is incorrect as recursion is a valid application.

Rate this question:

• 11.

### In a Binary tree we can insert___________ nodes as its children

• A.

1

• B.

2

• C.

3

• D.

>=4

B. 2
Explanation
In a binary tree, each node can have a maximum of two children. Therefore, we can insert a maximum of two nodes as children for each node in the binary tree.

Rate this question:

• 12.

### Friend function is

• A.

An inline function

• B.

Violates class property

• C.

Always preferable

• D.

None

B. Violates class property
Explanation
A friend function violates class property because it is not a member of the class, yet it has access to the private and protected members of the class. This breaks the principle of encapsulation, which aims to hide the internal details of a class and only allow access through member functions. Friend functions can be useful in certain cases, such as when they need to access multiple classes or when they require direct access to private members, but they should be used sparingly to maintain the integrity of the class.

Rate this question:

• 13.

### Abstract class

• A.

Can be instantiated

• B.

Can be inherited

• C.

Have only virtual functions

• D.

None

B. Can be inherited
Explanation
An abstract class is a class that cannot be instantiated on its own, meaning you cannot create objects of that class. However, it can be inherited by other classes. Inheritance allows the child class to inherit the properties and methods of the abstract class, enabling code reuse and creating a hierarchical relationship between classes. Therefore, the correct answer is that an abstract class can be inherited.

Rate this question:

• 14.

### Can we use friend function for overlaoding= operator

• A.

We can

• B.

We can n't

• C.

By writing outside definition

• D.

None

B. We can n't
Explanation
The correct answer is "we can't". This is because the assignment operator (=) cannot be overloaded using a friend function. The assignment operator can only be overloaded using a member function.

Rate this question:

• 15.

### Virtual base class is

• A.

Usefull to avoid ambiguity in hybrid inheritance in accessing grand parent by grand child

• B.

A virtual function

• C.

Can not exist any where

• D.

Having only pure virtual functions

A. Usefull to avoid ambiguity in hybrid inheritance in accessing grand parent by grand child
Explanation
The virtual base class is useful in hybrid inheritance to avoid ambiguity when accessing the grandparent by the grandchild. This is because in hybrid inheritance, a class can inherit from multiple classes, which can lead to the same member being inherited multiple times. By making the base class virtual, it ensures that there is only one instance of the base class, resolving any ambiguity that may arise.

Rate this question:

• 16.

### Sparse matrix is

• A.

With more no of 1's

• B.

Mostly with 0s

• C.

Non singular matrix

• D.

Have diagnal elements as zeros

B. Mostly with 0s
Explanation
A sparse matrix is mostly filled with zeros. In a sparse matrix, the majority of the elements are zero, while only a few elements have non-zero values. This characteristic of having mostly zeros makes sparse matrices different from dense matrices, where most of the elements are non-zero. Sparse matrices are commonly encountered in various fields, such as scientific computing and data analysis, where they help in efficient storage and computation by avoiding unnecessary calculations with zeros.

Rate this question:

• 17.

### A multiply list is

• A.

A list in which each node is multiplied with other nodes

• B.

A list in which each node has muliple fields

• C.

Used as representation of sparse matrix

• D.

B&c

D. B&c
Explanation
A multiply list is a list in which each node has multiple fields and is also used as a representation of a sparse matrix. This means that each node in the list contains multiple values or attributes, making it a versatile data structure. Additionally, it is specifically designed to efficiently store and manipulate sparse matrices, which have a large number of zero elements. Therefore, both options b and c are correct.

Rate this question:

• 18.

### Hashing is

• A.

A statement as header file inclusion

• B.

Address finding in sequential file organition

• C.

Address finding in random file organition

• D.

None

C. Address finding in random file organition
Explanation
Hashing is a technique used for address finding in random file organization. It involves the use of a hash function to map data elements to specific locations in a hash table or an array. This allows for quick retrieval of data based on its key or address, making it efficient for random access to files. Hashing is not related to header file inclusion or sequential file organization.

Rate this question:

• 19.

### In fold and  method of hashing we can

• A.

Fold only digits

• B.

Fold from both sides

• C.

We can fold either from left or right or both sides

• D.

Is not a method of hashing

C. We can fold either from left or right or both sides
Explanation
The correct answer states that in the fold and method of hashing, we have the flexibility to fold either from the left or right side, or even both sides. This means that when using the fold method in hashing, we are not restricted to folding in a specific direction. We have the option to fold the data in whichever way is most suitable for the hashing process.

Rate this question:

• 20.

### We can overload ___ operators

• A.

Sizeof

• B.

::

• C.

->

• D.

=

• E.

None

D. =
Explanation
The correct answer is "=" because the "=" operator can be overloaded in C++ to define a custom behavior for assignment operations between objects of a user-defined class. This allows for more flexibility and control over how objects are assigned values.

Rate this question:

• 21.

### If we use protected as access specifier in accessing base class ,the private member in base class becomes________ in derived class

• A.

Public

• B.

Private

• C.

Protected

• D.

Not accessible

D. Not accessible
Explanation
When we use the "protected" access specifier in accessing the base class, the private member in the base class becomes "not accessible" in the derived class. This is because the "protected" access specifier allows the derived class to access the members of the base class, but it does not allow access to private members. Therefore, the private member in the base class cannot be accessed or inherited by the derived class.

Rate this question:

• 22.

### Containership in c++ refers to

• A.

Declaring objects of a class as memebers in another class

• B.

Contains data in private only

• C.

Contains constant member functions

• D.

None

A. Declaring objects of a class as memebers in another class
Explanation
The correct answer is declaring objects of a class as members in another class. In C++, a containership refers to the practice of including objects of one class within another class. This allows for the creation of complex data structures and facilitates the organization and management of related data. By declaring objects of a class as members in another class, the container class can access and manipulate the data and functionality of the contained class.

Rate this question:

• 23.

### C++ was developed by

• A.

Dennis ritch

• B.

Mark yordan

• C.

Alen rux

• D.

Stroustrup

• E.

D. Stroustrup
Explanation
C++ was developed by Bjarne Stroustrup.

Rate this question:

• 24.

### All search trees will have traversing techniques

• A.

True

• B.

False

• C.

True or false

• D.

None

A. True
Explanation
The statement is stating that all search trees will have traversing techniques. This means that regardless of the specific type or structure of a search tree, there will always be techniques available to traverse or navigate through the tree. Therefore, the answer is true.

Rate this question:

• 25.

### The tree traversals are

• A.

Dfs,bfs

• B.

Inorder,preorder,postorder

• C.

MSP,DSP,TSP

• D.

None

B. Inorder,preorder,postorder
Explanation
The correct answer is "inorder,preorder,postorder". These are the three common types of tree traversals. In inorder traversal, the left subtree is visited first, then the root, and finally the right subtree. Preorder traversal visits the root first, then the left subtree, and finally the right subtree. Postorder traversal visits the left subtree first, then the right subtree, and finally the root. These traversals are used to visit all the nodes in a tree in a specific order.

Rate this question:

Related Topics Back to top