Data Structure Multiple Choice Questions and Answers pdf

Data Structure Multiple Choice Questions and Answers pdf

Data structures and algorithms multiple choice questions with answers pdf. Data structures MCQs. Multiple choice questions and answers on data structure in Pdf are a great way to test your understanding of the data structures and algorithms.

Algorithms and Data Structure MCQ questions and answers pdf also provide a valuable resource for those who wish to get ahead in their studies or use it as a reference for their work.

Data Structure Multiple Choice Questions

Data Structure Multiple Choice Questions and Answers

1. The ‘C’ language is developed by —-
A) Ken Martin
B) Thomson
C) Charles Babbage
D) Dennis Ritchie
Answer: (D) Explanation: Dennis Ritchie is the creator of the C programming language.

2. There is the —- number of keywords in the ‘C’ language.
A) 30
B) 32
C) 31
D) 35
Answer: (B) Explanation: The C language has 32 keywords that are reserved for specific purposes and cannot be used as variable names or identifiers.

3. —- is any well-defined computational procedure that takes a value or a set of values as input and produces an output.
A) Algorithm
B) Flowchart
C) Program
D) process
Answer: (A) Explanation: An algorithm is a step-by-step procedure or a set of rules for solving a specific problem or accomplishing a specific task.

4. The algorithm should be effective, which means it must have —-
A) basic primitive
B) basic steps
C) complex primitive
D) complex steps
Answer: (A) Explanation: An effective algorithm should have basic primitive operations that can be executed efficiently.

5. Which of these statements is used for multi-way branching?
A) switch
B) for
C) if
D) auto
Answer: (A) Explanation: Switch statement in C is used for multi-way branching, allowing different code blocks to be executed based on different values of an expression.

6. Which statement is used to end the loop and move the control to the next statement outside the loop?
A) continue
B) break
C) exit
D) switch
Answer: (B) Explanation: Break statement is used to terminate the loop and transfer control to the next statement outside the loop.

7. Array is also known as —-
A) keyword
B) reserved word
C) subscripted variable
D) simple variable
Answer: (C) Explanation: Arrays in C are also known as subscripted variables because elements in an array are accessed using their indices or subscripts.

8. —- is the process of re-arranging a given set of objects in a specific order.
A) Searching
B) instantiation
C) sorting
D ) swapping
Answer: (C) Explanation: Sorting is the process of arranging a collection of items or data in a specific order, such as ascending or descending.

9. Every ‘C’ program can be thought of as a collection of —-
A) Keywords
B) functions.
C) variables
D) constants
Answer: (B) Explanation: In C, programs are typically structured as a collection of functions that perform specific tasks or operations.

10. To use the library function at of(), which header file must be included in the program?
A) math.h
B) string.h
C) process.h
D) conio.h
Answer: (A) Explanation: The math.h header file in C provides declarations for mathematical functions, including the “atof()” function.

11. Pointer arithmetic is possible for —- and —-, but it has no meaning of —– and —-.
A) multiplication, division, addition, subtraction
B) addition, subtraction, multiplication, division
C) preincrement, predecrement, postincrement, postdecrement
D) postincrement, postdecrement, preincrement, predecrement
Answer: (B) Explanation: Pointer arithmetic in C is supported for addition and subtraction operations. Multiplication and division operations are not meaningful with pointers.

12. —- is a special type of variable which is used to hold the address of the variable.
A) structure
B) union
C) pointer
D) void
Answer: (C) Explanation: Pointers in C are variables that store memory addresses. They are used to indirectly access and manipulate data stored in memory.

13. Which of the following is an invalid file open mode?
A) wb+
B) ab+
C) rb+
D) wr+
Answer: (D) Explanation: The file open mode “wr+” is invalid. The valid file open modes in C include “wb+” (write and read in binary mode), “ab+” (append and read in binary mode), and “rb+” (read and write in binary mode).

14. Which functions allow you to write individual characters to a stream?
A) fputc()
B) putc()
C) both A) and B)
D) none of these
Answer: (C) Explanation: Both the fputc() and putc() functions in C can be used to write individual characters to a stream.

15. —- is a representation of data and the operations allowed on that data.
A) program
B) data structure
C) data type
D) structure
Answer: (B) Explanation: A data structure in C is a way of organizing and storing data in a specific format. It defines the representation of data and the operations that can be performed on that data.

16. A data structure is said to be —- if its elements form a sequence.
A) bipolar
B) linear
C) polar
D) scalar
Answer: (B) Explanation: A linear data structure in C is one where the elements are arranged in sequential order. Examples include arrays, linked lists, stacks, and queues.

17. A stack is very useful in situations when data have to be stored and then retrieved in the —- order.
A) same
B) reverse
C) ascending
D) descending
Answer: (B) Explanation: A stack in C follows the Last-In-First-Out (LIFO) principle, where the last item pushed into the stack is the first one to be popped out. This allows data to be stored and retrieved in the reverse order of their insertion.

18. —- is useful in the evaluation of the arithmetic expression.
A) stack
B) queue
C) tree
D) Graph
Answer: (A) Explanation: A stack is commonly used in evaluating arithmetic expressions, particularly infix expressions, by storing operators and operands and applying them based on their precedence and associativity.

19. which of these principles is used in a stack?
A) Last in first out
B) First in first out
C) Last in last out
D) None of these
Answer: (A) Explanation: The principle of Last-In-First-Out (LIFO) is used in a stack where the most recently inserted item is the first one to be removed.

20. A stack is defined formally as a list in which all insertions and deletions are made at —-
A) same time
B ) same end
C ) different end
D) both A) and B)
Answer: (B) Explanation: In a stack, all insertions (push operation) and deletions (pop operation) are made at the same end, which is the top of the stack.

21. Linked lists enable insertion and removal of nodes at any position in the list in constant time but do not allow —-.
A ) random access.
B) displaying items
C) searching
D) all of these
Answer: (A) Explanation: Unlike arrays, linked lists do not allow direct access to elements by index. Random access requires traversing the list from the beginning, resulting in linear time complexity.

22. —- is a self-referential data type because it contains a pointer or links to another datum of the same type.
A) Stack
B) Queue
C) A linked list
D) None of these
Answer: (C) Explanation: A linked list is a data structure where each node contains data and a reference/pointer to the next node. This self-referential property makes linked lists useful for dynamically storing and accessing data.

23. In a singly linked list, the link field of —- contains a null pointer.
A) first node
B) any node
C) middle node
D) the last node
Answer: (D) Explanation: The last node in a singly linked list has its link field pointing to NULL, signifying the conclusion of the list.

24. In —-, the link field of the last node contains a null pointer.
A) stack
B) queue
C) singly linked list
D) circular linked list
Answer: (C) Explanation: In a singly linked list, the last node’s link field points to NULL, indicating the end of the list.

25. A node that has both a parent and at least one child is called —-
A) Nonleaf
B) leaf
C) root
D) root
Answer: (A) Explanation: In a tree, a nonleaf node is a node that has at least one child. Nonleaf nodes are also referred to as internal nodes or intermediate nodes.

26. A strictly binary tree in which the number of nodes at any level I is —-, the tree is said to be a complete binary tree.
A) 2 i -1
B) 2 i -1
C) 2i – 1
D) 2 i + 1
Answer: (B) Explanation: In a complete binary tree, all levels except possibly the last level are completely filled, and all nodes are as far left as possible. The number of nodes at a level i in a complete binary tree can be calculated using the formula 2^i – 1.

27. In the case of the AVL tree, the lookup takes —- time.
A) n log n
B) O (log n)
C) O (n log n)
D) log n
Answer: (B) Explanation: AVL trees are self-balancing binary search trees. The lookup operation in an AVL tree has a time complexity of O(log n) due to its balanced structure.

28. A tree can also be represented using an array, which is called —- representation
A) asymmetric
B) random
C) symmetric
D) sequential
Answer: (D) Explanation: A sequential representation of a tree involves using an array to represent the nodes of the tree. The array elements are arranged in a specific order based on the tree’s properties.

29. When the edges in a graph have no direction, the graph is called—- graph
A) undirected.
B) simplex
C) duplex
D) nondirected
Answer: (A) Explanation: In an undirected graph, the edges do not have any direction associated with them. They represent symmetric relationships between vertices.

30. A directed graph is —- if at least two vertices are not connected.
A) strongly disconnected
B) weakly connected
C) weekly disconnected
D) strongly connected
Answer: (B) Explanation: A directed graph is said to be weakly connected if there is at least one path between any two vertices, regardless of the direction. It means that the graph can be considered as undirected when ignoring the edge directions.

31. The outdegree of a vertex in a digraph is —-
A) number of arcs leaving the vertex.
B) number of arcs entering the vertex
C) total no of vertex connected to that vertex
D) total no of vertex disconnected to that vertex
Answer: (A) Explanation: In a directed graph (digraph), the outdegree of a vertex refers to the number of arcs/edges leaving that vertex.

32. If every vertex of any graph has the same degree, then the graph is called —-
A) directed graph
B) undirected graph
C) regular graph.
D) subgraph
Answer: (C) Explanation: A regular graph is a graph where all vertices have the same degree, i.e., the same number of edges connected to them.

33. Most of the algorithms studied by computer scientists that solve problems are kinds of —-
A)search algorithms.
B) sort algorithms
C) data structures
D) None of these
Answer: (A) Explanation: Search algorithms are commonly used in computer science to find solutions to problems by exploring and examining different states or paths.

34. The set of all possible solutions to a problem is called the —-
A) Database
B) data structure
C ) search space
D) None of these
Answer: (C) Explanation: The search space refers to the set of all possible solutions that can be explored or searched during problem-solving.

35. Informed search algorithms use —- functions to apply knowledge about the structure of search space to try to reduce the amount of time spent in searching.
A) built-in
B) heuristic
C) user-defined
D) Complex
Answer: (B) Explanation: Informed search algorithms incorporate heuristic functions that provide additional information about the problem domain to guide the search process more effectively. Heuristics aim to estimate the likelihood of finding a solution in a particular direction within the search space.

36. The binary search method needs no; more than —- comparisons.
A) [Iog2n]+1
B) Iog2n
C) [Iog2n]-1
D) [Iog2n]+2
Answer: (A) Explanation: In binary search, the number of comparisons required to find an element in a sorted array is approximately [log2(n)] + 1, where n is the number of elements in the array.

37. Let P=50 after executing the following instruction. What will be the value of P and Q?
Q= p++;
A) P= 51 Q= 50
B) P=51 Q=51
C) P=50 Q=50
D) P=50 Q=51
Answer: (A) Explanation: The post-increment operator (p++) increments the value of p after assigning its original value to Q. Therefore, P becomes 51 and Q takes the original value of P, which is 50.

38. From the following list, identify a ‘C’ keyword.
i) for
ii) while
iii) auto
iv) shortest
v) long
A) i), ii) and v)
B) i) and v)
C) i), iii) and v)
D) i), ii), iv) and v)
Answer: (C) Explanation: In the given list, “for,” “auto,” and “long” are keywords in the C programming language. Keywords are reserved words with predefined meanings and cannot be used as identifiers.

39. The pictorial representation of the algorithm is called —-
A) Dataflow
B) process flow
C) Flowchart
D) process chart
Answer: (C) Explanation: A flowchart is a graphical representation of an algorithm or a process. It uses various symbols and arrows to represent different steps, decisions, and flow of control.

40. The rectangle symbol in the flowchart represents —-
A) Decision making
B) start or end of the flowchart
C) Processing
D) None of these
Answer: (C) Explanation: In a flowchart, the rectangle symbol represents a process or an operation to be performed. It indicates a specific action or calculation that takes place in the algorithm.

41. The goto statement is the —- statement
A) conditional control
B) unconditional control
C) looping
D) both A) and C)
Answer: (B) Explanation: The goto statement in C is an unconditional control statement that allows transferring control to a labeled statement within the same function. Its use is generally discouraged due to its potential to create spaghetti code.

42. Which is an entry-controlled loop?
A) do-while
B) switch
C) continue
D) while
Answer: (D) Explanation: The “while” loop is an entry-controlled loop in C. It checks the loop condition before executing the loop body. If the condition is true, the loop body is executed; otherwise, the loop is terminated.

43. What is an array?
A) collection of variables of a different type.
B) collection of variables of the same type
C) collection of data objects of the same type
D) collection of data objects of different type
Answer: (C) Explanation: An array in C is a collection of elements of the same data type stored in contiguous memory locations. It allows storing multiple values under a single name and accessing them using an index.

44. C automatically converts any intermediate value to the proper types so that the expression can be evaluated without losing any significance. This conversion is called—-
A) typecasting
B) swapping
C) data conversion
D) instantiation
Answer: (A) Explanation: Typecasting is the process of converting a value from one data type to another in C. It ensures that the data types are compatible and allows performing operations without losing precision or information.

45. The function fmod (variable/value, variable/value) returns —-
A) the remainder of two floating-point value
B) quotient of two floating-point value
C) the remainder of two integer value
D) quotient of two integer value
Answer: (A) Explanation: The fmod() function in C calculates the remainder of dividing two floating-point values and returns the result.

46. What is the user-defined function?
A) Function available in the header file
B) function available in the ‘C’ compiler
C) a function was written by the user
D) either A) or B)
Answer: (C) Explanation: A user-defined function in C is a function that is created and implemented by the programmer to perform a specific task. It extends the functionality of the language by allowing custom operations.

47. The process of allocating memory at run time is called —-
A) static memory allocation
B) dynamic memory allocation
C) pre memory allocation
D) post-memory allocation
Answer: (B) Explanation: Dynamic memory allocation is the process of allocating memory during program execution to store data dynamically. It allows programs to request memory as needed and manage memory usage efficiently.

48. Which of these functions are used for dynamic memory allocation?
A) calloc()
B) realloc
C) malloc()
D) all of these
Answer: (D) Explanation: The functions calloc(), realloc(), and malloc() are used for dynamic memory allocation in C. They allow allocating memory dynamically at run time based on program requirements.

49. Which of these functions is used to read a string from a stream?
A) fgetc()
B) fgetws()
C) getc()
D) fputc()
Answer: (B) Explanation: The fgetws() function is used to read a string from a stream in C. It reads a sequence of wide characters from a file stream or standard input and stores them in a wide character array.

50. Identify file open function.
A) fopen()
B) freopen()
C) tmpfile()
D) all of these
Answer: (D) Explanation: The functions fopen(), freopen(), and tmpfile() are file open functions in C. They are used to open files and create file streams for reading or writing data.

C Programming MCQ with answers pdf

Artificial Intelligence MCQ Question Bank with Answers

Conclusion Points

Data Structure Questions and Answers pdf provides a great way to understand data structures and algorithms better. By studying this resource, individuals can gain an appreciation for the power of data structures and see how they are used in computer programming.

Thanks for visiting our website; if you read the post on MCQ on data structure with answers pdf, Data Structure Multiple Choice Questions and Answers, please give your feedback through below comment form.

C Programming 25 important true false quiz Part-1

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top