Using Programs with Data MCQ Practice

Question 1 of 10

A store inventory table is shown.

Row Item Price Qty
1 Notebook 3 10
2 Pen 1 25
3 Notebook 3 4
4 Eraser 2 8
5 Pen 1 12

A program keeps only rows where Item equals Notebook. Which rows remain?

  1. A. Rows 1 and 3
  2. B. Rows 1, 2, and 3
  3. C. Row 1 only
  4. D. Rows 2 and 5

Question 2 of 10

Using the same inventory table:

Row Item Price Qty
1 Notebook 3 10
2 Pen 1 25
3 Notebook 3 4
4 Eraser 2 8
5 Pen 1 12
total ← 0
FOR EACH row IN table
{
    IF row.Item = "Pen"
    {
        total ← total + row.Qty
    }
}
DISPLAY(total)

What value is displayed?

  1. A. 25
  2. B. 37
  3. C. 12
  4. D. 5

Question 3 of 10

Temperatures in a list: temps ← [18, 21, 19, 22, 20] (1-based indices).

sum ← 0
i ← 1
REPEAT 5 TIMES
{
    sum ← sum + temps[i]
    i ← i + 1
}
avg ← sum / 5
DISPLAY(avg)

What is displayed?

  1. A. 100
  2. B. 22
  3. C. 20
  4. D. 19

Question 4 of 10

Student quiz table:

Name Score
Ava 88
Ben 72
Cara 95
Drew 72
Eli 81
count ← 0
FOR EACH row IN table
{
    IF row.Score ≥ 80
    {
        count ← count + 1
    }
}
DISPLAY(count)

What is displayed?

  1. A. 4
  2. B. 5
  3. C. 2
  4. D. 3

Question 5 of 10

Using the inventory table:

Row Item Price Qty
1 Notebook 3 10
2 Pen 1 25
3 Notebook 3 4
4 Eraser 2 8
5 Pen 1 12
best ← table[1]
i ← 2
REPEAT UNTIL i > 5
{
    IF table[i].Qty > best.Qty
    {
        best ← table[i]
    }
    i ← i + 1
}
DISPLAY(best.Item)

What item name is displayed?

  1. A. Pen
  2. B. Eraser
  3. C. Qty
  4. D. Notebook

Question 6 of 10

Library loans:

Title DaysLate
Mars Map 0
Binary Tales 3
Data Day 1
Pixel Park 0

A filter keeps rows where DaysLate > 0. Which titles remain?

  1. A. All four titles
  2. B. Binary Tales and Data Day
  3. C. Mars Map and Pixel Park
  4. D. Only Binary Tales

Question 7 of 10

nums ← [4, 9, 6, 8]

i ← 1
found ← false
REPEAT UNTIL i > 4 OR found
{
    IF nums[i] = 6
    {
        found ← true
        DISPLAY(i)
    }
    i ← i + 1
}

What is displayed?

  1. A. 1
  2. B. 2
  3. C. 3
  4. D. 4

Question 8 of 10

Team points table:

Team Points
North 10
East 14
South 9
West 14
Central 11
sum ← 0
n ← 0
FOR EACH row IN table
{
    IF row.Points ≥ 11
    {
        sum ← sum + row.Points
        n ← n + 1
    }
}
DISPLAY(sum / n)

What value is displayed?

  1. A. 11.6
  2. B. 14
  3. C. 12
  4. D. 13

Question 9 of 10

A program transforms every Price in the inventory table by computing Price * Qty for each row and then displays the maximum of those products.

Row Item Price Qty
1 Notebook 3 10
2 Pen 1 25
3 Notebook 3 4
4 Eraser 2 8
5 Pen 1 12

What maximum revenue contribution is displayed?

  1. A. 30
  2. B. 25
  3. C. 16
  4. D. 12

Question 10 of 10

After filtering the inventory table to Qty ≥ 10, which statement is true?

Row Item Price Qty
1 Notebook 3 10
2 Pen 1 25
3 Notebook 3 4
4 Eraser 2 8
5 Pen 1 12
  1. A. No rows remain
  2. B. Rows 1, 2, and 5 remain
  3. C. Only row 4 remains
  4. D. Rows 3 and 4 remain