Posts

Showing posts with the label Data Structure and Algorithms MCQ

Data Structure and Algorithms MCQ IT Officer(PSC)

  1. A queue follows a. LIFO principle b. FIFO principle c. Linear tree d. Ordered array Correct Answer: b Explanation: A queue follows the First-In-First-Out (FIFO) principle, where the first element added is the first to be removed, similar to a real-world queue (e.g., a line of people). LIFO (Last-In-First-Out) applies to stacks, not queues. 2. The time complexity used for inserting a node in a priority queue on the basis of key is: a. O(n) b. O(n²) c. O(nlogn) d. O(log n) Correct Answer: d Explanation: In a priority queue implemented using a heap (e.g., binary heap), insertion involves adding an element and performing a heapify-up operation, which takes O(log n) time due to the height of the tree. The given answer "a" is incorrect; the correct answer is "d". 3. Which of these is a postfix expression? a. a + b - c b. +ab c. abc*+de-+ d. a b(c+d) Correct Answer: c Explanation: A postfix expression (Reverse Polish Notation) places operators...