Top MCQs on Data Structures in DSA with Answers

Last Updated :
Discuss
Comments

Question 1

Consider a source with symbols A, B, C, D with probabilities 1/2, 1/4, 1/8, 1/8 respectively. What is the average number of bits per symbol for the Huffman code generated from above information ?
  • A
    2 bits per symbol
  • B
    1.75 bits per symbol
  • C
    1.50 bits per symbol
  • D
    1.25 bits per symbol

Question 2

If h is chosen from a universal collection of hash functions and is used to hash n keys into a table of size m, where n ≤ m, the expected number of collisions involving a particular key x is less than _______.
  • A
    1
  • B
    1/n
  • C
    1/m
  • D
    n/m

Question 3

Below are the few steps given for scan-converting a circle using Bresenham’s Algorithm. Which of the given steps is not correct ?
  • A
    Compute d = 3 – 2r (where r is radius)
  • B
    Stop if x > y
  • C

    If d < 0, then d = 4x + 6 and x = x + 1

  • D
    If d ≥ 0, then d = 4 ∗ (x – y) + 10, x = x + 1 and y = y + 1

Question 4

Consider a line AB with A = (0, 0) and B = (8, 4). Apply a simple DDA algorithm and compute the first four plots on this line.
  • A
    [(0, 0), (1, 1), (2, 1), (3, 2)]
  • B
    [(0, 0), (1, 1.5), (2, 2), (3, 3)]
  • C
    [(0, 0), (1, 1), (2, 2.5), (3, 3)]
  • D
    [(0, 0), (1, 2), (2, 2), (3, 2)]

Question 5

The minimum number of scalar multiplication required, for parenthesization of a matrix-chain product whose sequence of dimensions for four matrices is <5, 10, 3, 12, 5> is

  • A
    630
  • B
    580
  • C
    480
  • D
    405

Question 6

Consider the following AO graph: 56 Which is the best node to expand next by AO* algorithm?

  • A
    A
  • B
    B
  • C
    C
  • D
    B and C

Question 7

A t-error correcting q-nary linear code must satisfy: 65 Where M is the number of code words and X is

  • A

    qn

  • B

    qt

  • C

    q-n

  • D

    q-t

Question 8

Consider the following statements: S1: A queue can be implemented using two stacks. S2: A stack can be implemented using two queues. Which of the following is correct?
  • A

    S1 is correct and S2 is not correct.

  • B

    S1 is not correct and S2 is correct.

  • C

    Both S1 and S2 are correct.

  • D

    Both S1 and S2 are incorrect.

Question 9

Given the following prefix expression: * + 3 + 3 ↑ 3 + 3 3 3 What is the value of the prefix expression ?
  • A
    2178
  • B
    2199
  • C
    2205
  • D
    2232

Question 10

In how many ways can the string A ∩ B – A ∩ B – A be fully parenthesized to yield an infix expression?

  • A

    15

  • B

    14

  • C

    13

  • D

    12

There are 39 questions to complete.

Take a part in the ongoing discussion