Free Practice Quiz Question List

12 Discrete Structures and Algorithms Online Quiz Questions

Use this free practice quiz with 20 questions to review 12 Discrete Structures and Algorithms, test your knowledge, and prepare for your next test or exam.

20 questions
01
Choose one
1 point

Which Boolean identity correctly simplifies the complement of an AND expression?

  1. A

    A+B‾=A‾+B‾\overline{A+B}=\overline A+\overline B

  2. B

    AB‾=A‾+B‾\overline{AB}=\overline A+\overline B

  3. C

    AB‾=A‾ B‾\overline{AB}=\overline A\,\overline B

  4. D

    A+A‾=0A+\overline A=0

02
Choose one
1 point

A propositional circuit has three independent Boolean input variables. How many rows are required for its complete truth table?

  1. A

    3

  2. B

    6

  3. C

    8

  4. D

    9

03
Choose one
1 point

Which precondition is essential for the usual binary-search step that discards half of the remaining array?

  1. A

    The array is sorted.

  2. B

    The array contains no duplicate values.

  3. C

    The target is at the first or last position.

  4. D

    The array has exactly 2k2^k elements.

04
True or false
1 point

True or false: Every problem in P is also in NP.

  1. A

    True

  2. B

    False

05
True or false
1 point

True or false: During linear search, the loop invariant proves before every iteration that the target is absent from the entire array.

  1. A

    True

  2. B

    False

06
Written response
1 point

What is the technical term for a condition that must be true before an algorithm executes?

07
Written response
1 point

Using Theta notation, classify the asymptotic growth of 3n2+7n+43n^2+7n+4.

08
Fill in the blank
1 point

In a standard loop-invariant proof, the first step is , which shows the invariant holds initially. The second step is , which shows that one iteration preserves it.

09
Fill in the blank
1 point

In the definition of NP, a proposed yes-answer that can be checked in polynomial time is called a .

10
Choose all
1 point

Select all gate types that the material identifies as universal gates.

  1. A

    NAND

  2. B

    XOR

  3. C

    NOR

  4. D

    AND

11
Choose all
1 point

Select all statements that are consistent with the material’s distinction between algorithm correctness and complexity analysis.

  1. A

    Whether the algorithm produces the required result

  2. B

    How resource use grows with input size

  3. C

    Whether the algorithm uses a particular programming language

  4. D

    Whether machine-specific constants are being abstracted away when comparing asymptotic growth

12
Open ended
1 point

Compare linear search and binary search on an array of length nn. Explain the worst-case time bound of each algorithm and state the precondition that makes binary search’s bound valid.

13
Choose one
1 point

Suppose there is a polynomial-time reduction A≤pBA\le_p B. Which conclusion follows if problem BB has a polynomial-time algorithm?

  1. A

    If A≤pBA\le_p B, a fast algorithm for AA automatically solves BB.

  2. B

    If A≤pBA\le_p B and BB is solvable in polynomial time, then AA is solvable in polynomial time.

  3. C

    If A≤pBA\le_p B, then AA and BB must have identical inputs.

  4. D

    If A≤pBA\le_p B, then BB is necessarily in P regardless of the status of AA.

14
Choose one
1 point

Which Boolean expression is equivalent to A+ABA+AB?

  1. A

    A+BA+B

  2. B

    AA

  3. C

    ABAB

  4. D

    BB

15
True or false
1 point

True or false: Binary search can correctly discard half of the remaining search interval after each comparison in an arbitrary unsorted array.

  1. A

    True

  2. B

    False

16
Choose one
1 point

For the circuit f(A,B,C)=(A∧B)∨¬Cf(A,B,C)=(A\land B)\lor\lnot C, what output is produced when A=1A=1, B=0B=0, and C=0C=0?

  1. A

    0, because the AND gate receives a zero

  2. B

    0, because ¬C=0\lnot C=0

  3. C

    1, because ¬C=1\lnot C=1

  4. D

    1, because both AA and BB are true

17
Written response
1 point

What is the tight asymptotic classification of 3n2+7n+43n^2+7n+4? Enter your answer in standard Big-Theta notation.

18
Choose one
1 point

Which statement is a suitable loop invariant for linear search after positions 11 through i−1i-1 have been checked?

  1. A

    The target occurs at position ii.

  2. B

    Every position from ii through nn has already been checked.

  3. C

    The target does not occur in positions 11 through i−1i-1, unless the algorithm has already returned.

  4. D

    The array is sorted through position i−1i-1.

19
Written response
1 point

How many rows are required for a complete truth table with five Boolean input variables?

20
Choose one
1 point

Ignoring constant factors and lower-order effects, which algorithm is generally more scalable for large inputs: one running in O(nlog⁡n)O(n\log n) time or one running in O(n2)O(n^2) time?

  1. A

    An O(nlog⁡n)O(n\log n) algorithm

  2. B

    An O(n2)O(n^2) algorithm

  3. C

    They must have identical running times

  4. D

    Neither bound gives any information about scalability