0% found this document useful (0 votes)
30 views16 pages

DS - Questions Sheet

Uploaded by

moo.a.qassem
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)
30 views16 pages

DS - Questions Sheet

Uploaded by

moo.a.qassem
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
You are on page 1/ 16

1. What is the primary purpose of a data structure?

A) To store data randomly

B) To encrypt data

C) To delete data

D) To organize data efficiently

2. Which of the following is a characteristic of a data structure?

A) Size

B) Correctness
Time Complexity, space
C) Color complexity
D) Shape

3. What does 'Time Complexity' refer to?

A) The amount of memory used

B) The speed of the processor

C) The running time of operations

D) The size of the data

4. In which case does a data structure operation take the maximum time?

A) Best Case

B) Average Case

C) Worst Case

D) Optimal Case
5. Which of the following is a non-linear data structure?

A) Array

B) Stack

C) Queue

D) Tree

6. What type of data structure is an array?

A) Non-linear

B) Linear

C) Hierarchical

D) Graph

7. Which data structure allows dynamic memory allocation?

A) Array

B) Stack

C) Linked List

D) Queue

8. Which operation is performed on an array?

A) Insertion

B) Deletion

C) Searching

D) All of the Above


9. What is the index of the first element in an array?

A) 0

B) 1

C) -1

D) Depends on the programming language

10.Which of the following data types is NOT a built-in data type?

A) Integer

B) String
Derived
C) List

D) Boolean

11.In which data structure are elements stored sequentially?

A) Tree

B) Graph

C) Map

D) Array

12.What is the main disadvantage of static linear data structures?

A) Complexity

B) Wastage of memory

C) Speed

D) Accessibility
13.Which of the following is an example of a derived data type?

A) Integer

B) Character

C) Stack

D) Float

14.What does 'traversing' an array mean?

A) Accessing all elements

B) Deleting an element

C) Searching for an element

D) Updating an element

15.Which operation involves adding an element to an array?

A) Deletion

B) Insertion

C) Traversing

D) Searching

16.What is the time complexity for accessing an element in an array?

A) O(n)

B) O(log n)

C) O(1)

D) O(n^2)
17.What is a record in the context of data structures?

A) A single data item

B) A collection of fields

C) A collection of arrays

D) A group of data items

18.Which of the following is true about linked lists?

A) They are static data structures

B) They have a fixed size

C) They allow dynamic memory allocation

D) They are slower than arrays

19.What is the purpose of a queue?

A) To store data randomly

B) To manage data in a circular manner

C) To process data in a Last In First Out (LIFO) manner

D) To process data in a First In First Out (FIFO) manner

20.Which of the following operations is used to remove an element from an


array?

A) Insertion

B) Deletion

C) Traversal

D) Sorting
21.What is the main drawback of using static arrays?

A) Slow access time

B) Difficulty in resizing

C) High memory usage

D) Complexity of implementation

22.Which data structure uses a Last In First Out (LIFO) order?

A) Stack

B) Queue

C) Array

D) Linked List

23.What is the main purpose of a searching algorithm?

A) To sort data

B) To find a specific value in a data structure

C) To delete data

D) To create new data

24.Which of the following best describes a tree data structure?

A) A linear collection of data

B) A flat array of data

C) A hierarchical structure with nodes

D) A collection of records
25.What does the term "merge" refer to in data structures?

A) Combining two data sets into one

B) Deleting elements

C) Searching for an element

D) Sorting elements

26.Which operation would you perform to access every element in an array


sequentially?

A) Insertion

B) Deletion

C) Traversal

D) Searching

27.In a linked list, each node typically contains:

A) Only data

B) Data and a pointer to the next node

C) Data and its index

D) Only a pointer

28.Which of the following is a characteristic of non-linear data structures?

A) Data is stored sequentially

B) Data can be stored in multiple levels

C) Easy to traverse

D) Fixed size
29.Which operation in an array can often lead to shifting elements?

A) Insertion at the end

B) Search

C) Traversal

D) Deletion from the middle

30.What does the term "attribute" refer to in data structures?

A) The type of data

B) A characteristic of an entity

C) The size of data

D) The method of data storage

31.What is the space complexity of an array?

A) O(1)

B) O(n)

C) O(log n)

D) O(n^2)

32.Which of this best describes an array?

A. A data structure that shows a hierarchical behavior


B. Arrays are immutable once initialized
C. Array is not a data structure
D. Container of objects of similar types
33.How do you initialize an array in C++?

A. int arr[3] = (1,2,3);


B. int arr(3) = {1,2,3};
C. int arr[3] = {1,2,3};
D. int arr(3) = (1,2,3);

34.What is the output of the following Java code?

#include <iostream>
using namespace std;
int main() {
int arr[] = {1, 2, 3, 4, 5}; // Declare and initialize the array
cout << arr[2] << endl; // Print the element at index 2
cout << arr[4] << endl; // Print the element at index 4
return 0; // Indicate successful completion
}
A. 3 and 5
B. 5 and 3
C. 2 and 4
D. 4 and 2

35.What are the disadvantages of arrays?

A. Data structure like queue or stack cannot be implemented


B. There are chances of wastage of memory space if elements inserted in an
array are lesser than the allocated size
C. Index value of an array can be negative
D. Elements are sequentially accessed
36.What are the advantages of arrays?

A. Objects of mixed data types can be stored


B. Elements in an array cannot be sorted
C. Index of first element of an array is 1
D. Easier to store elements of same data type

37.Elements in an array are accessed _____________

A. randomly
B. sequentially
C. exponentially
D. logarithmically

38.In general, the index of the first element in an array is __________

A. 0
B. -1
C. 2
D. 1

39.Which operation requires shifting elements to the right in an array?

A. Insertion at the end


B. Insertion at the beginning
C. Deletion from the end
D. Deletion from the beginning
40.Inserting an element at the end of an array has a time complexity of:

A. O(1)
B. O(n)
C. O(log n)
D. O(n^2)

41.What happens when you insert an element at the beginning of an array?

A. All elements remain in the same position


B. All elements are shifted one position to the right
C. The last element is removed
D. The array size decreases

42.What happens to the array size when inserting a new element?

A. It decreases by 1
B. It remains the same
C. It increases by 1
D. It doubles

43.Which operation requires shifting elements to the left in an array?

A. Insertion at the end


B. Insertion at the beginning
C. Deletion from a specific index
D. Deletion from the end
44.Deleting an element at the end of an array has a time complexity of:

A. O(1)
B. O(n)
C. O(log n)
D. O(n^2)

45.If you delete an element at index i in an array, what is the worst-case


time complexity?

A. O(log n)
B. O(n)
C. O(1)
D. O(n^2)

46.What happens to the array size when deleting an element?

A. It decreases by 1
B. It remains the same
C. It increases by 1
D. It doubles

47.What is the time complexity of linear search in an array?

A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
48.In a linear search, how many elements must be checked in the worst
case?

A. n
B. n/2
C. 1
D. log(n)

True/False Questions

49.Static linear data structures can dynamically resize.

50.Searching algorithms are used to find an element in a data structure.

51.Every data structure requires a specific implementation.

52.Elements in a stack are accessed in a First In First Out (FIFO) manner.

53.A tree is a type of linear data structure.

54.Data items can be numbers, text, or any type of information.

55.Memory usage of a data structure operation is known as space complexity.

56.A linked list consists of nodes that store data and pointers to the next node.

57.The average case of a data structure operation refers to the worst time taken.

58.An entity set is a group of entities that share similar attributes.

59.An array can store elements of different data types.

60.In a queue, the last element added is the first one to be removed.

61.Graphs are used to represent relationships between data.


62.The execution time of a data structure operation is irrelevant to its

efficiency.

63.The 'update' operation in an array modifies an existing element.

64.A file is a collection of records.

65.Elementary items cannot be divided further.

66.Sorting algorithms are used to arrange data in a specific order.

67.A field pertains to a specific attribute of an entity.

68.Arrays are best suited for situations requiring frequent insertions and

deletions.

69.The worst-case scenario for a data structure operation is always the same for

all operations.

70.Data search is one of the common problems faced by applications today.

71.The execution time cases include worst case, average case, and best case.

72.An entity is anything that exists with attributes.

73.A data structure can be both linear and non-linear at the same time.

74.The definition of data types includes built-in and derived types.

75.Each element in an array is identified by its index.

76.The basic operations of an array include insertion, deletion, and traversal.

77.Each data structure can have multiple valid implementations.

78.In a static linear data structure, memory cannot be resized after allocation.
79.The main advantage of arrays is their ability to support dynamic sizes.

80.Searching an element in an array can be done using sequential search.

81.Data structures are only relevant in programming languages.

You might also like