wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CPROG 1 | Long Quiz - MIDTERMS

Total questions: 40

Worksheet time: 40mins

Name
Class
Date
1.

Which term describes a solution that can be expressed as a finite, logically arranged sequence of steps?

a)

Algorithmic solution

b)

Heuristic solution

c)

Iterative solution

d)

Randomized solution

2.

A heuristic solution is best described as:

a)

Based on finite steps only

b)

Based on rules of thumb and past experience

c)

Guaranteed to be optimal

d)

Independent of human judgment

3.

Which is the correct order of the general problem‑solving steps?

a)

Identify alternatives → Identify problem → Evaluate → Select best → List instructions → Understand

b)

Identify problem → Understand → Identify alternatives → Select best → List instructions → Evaluate

c)

Understand → Evaluate → List instructions → Identify problem → Select best → Identify alternatives

d)

Select best → Identify alternatives → Evaluate → List instructions → Understand → Identify problem

4.

In the programming process, which phase includes 'Analysis and Specification' and 'General Solution'?

a)

Implementation phase

b)

Maintenance phase

c)

Problem‑solving phase

d)

Testing phase

5.

Which pair belongs to the Implementation phase?

a)

Verify and Use

b)

Translate algorithm into code and Test

c)

Analysis and Specification

d)

Maintain and Modify

6.

Which property of algorithms requires that execution finishes after a bounded number of operations?

a)

Effectiveness

b)

Finiteness

c)

Scope definition

d)

Input/Output definition

7.

Which pseudocode convention is recommended in the lessons?

a)

End statements with semicolons

b)

Use punctuation to terminate lines

c)

Every program starts with START and ends with STOP

d)

Combine multiple actions in one line if short

8.

Which of the following is NOT among the commonly used pseudolanguage operations listed?

a)

DISPLAY

b)

COMPUTE

c)

EXIT

d)

SYNCHRONIZE

9.

In flowcharting, which symbol denotes the beginning or end of a process?

a)

Process

b)

Terminal

c)

Decision

d)

On‑page connector

10.

Which flowchart type is primarily used by programmers to show program logic and operations performed?

a)

Data flow diagram

b)

Program flowchart

c)

System flowchart

d)

Entity‑relationship diagram

11.

Which statement about flowcharts in the lesson is TRUE?

a)

They are tied to a specific programming language

b)

They help trace logic errors before coding

c)

They cannot represent branching

d)

They replace the need for testing

12.

Which property ensures each algorithmic step has a single interpretation?

a)

Sequence definition

b)

Absence of ambiguity

c)

Scope definition

d)

Effectiveness

13.

According to the lesson, algorithms are independent of:

a)

Programming language

b)

Input and output

c)

Logical sequence

d)

Data types

14.

In pseudocode formatting, each statement should:

a)

Perform multiple actions for brevity

b)

Use punctuation to end statements

c)

Appear on a single line if possible and be indented

d)

Be aligned with START

15.

The for loop is considered 'predefined' because:

a)

It has no counter

b)

The number of iterations is predetermined in the loop's header

c)

It always runs indefinitely

d)

It checks its condition after the loop body

16.

In the for loop header for (init; condition; increment), when is the increment part executed?

a)

Before the first iteration

b)

Before checking the condition

c)

After each iteration of the loop body

d)

Only if the condition is FALSE

17.

Which is a logical error noted in the lesson?

a)

Indenting the loop body

b)

Placing a semicolon right after the for header

c)

Using braces for multiple statements

d)

Initializing the counter to 0

18.

Which advice is given about the for loop's counter?

a)

Change it inside the body to speed up loops

b)

Never change the value of the counter inside the loop body

c)

Use floating‑point counters

d)

Counters must decrease only

19.

The while loop is described as:

a)

Closed‑ended loop with predetermined iterations

b)

Open‑ended/event‑controlled loop

c)

A loop that always executes at least once

d)

A loop with no condition

20.

The general form of the while loop places the condition:

a)

After the loop body

b)

Before the loop body in parentheses

c)

Inside the printf statement

d)

In the increment part

21.

The do‑while loop differs from while because it:

a)

Evaluates the condition before the first iteration

b)

Always executes at least once

c)

Has no condition

d)

Cannot use braces

22.

In a do‑while loop, where is the condition checked?

a)

At the top

b)

In the middle

c)

At the bottom, after the body

d)

It's not checked

23.

According to the lesson, when the for loop's condition becomes FALSE (0):

a)

The loop repeats

b)

The program terminates

c)

Control passes to the statement after the loop

d)

The increment runs again then exits

24.

In the sample averaging program with do‑while, the variable average is computed:

a)

Before the loop starts

b)

Inside the loop

c)

After the loop using the accumulated sum

d)

Using integer division only

25.

Which of the following is identified in the lesson as a loop control statement?

a)

return

b)

break

c)

halt

d)

pause

26.

A while loop that starts with x = 1; while (x <= 10) { ... } will keep iterating as long as:

a)

x is exactly 10

b)

The condition evaluates to TRUE (1)

c)

The increment happens first

d)

x becomes negative

27.

In a for loop, the body can be:

a)

Only a single statement

b)

Only a function call

c)

A single statement or a block of statements

d)

Only an empty statement

28.

An array in C stores:

a)

Elements of different data types

b)

Elements of the same data type in contiguous memory

c)

Data in scattered memory locations

d)

Only characters

29.

Which is NOT a listed characteristic of arrays in C?

a)

Fixed size

b)

Homogeneous elements

c)

Indexed access

d)

Dynamic resizing at runtime

30.

The index of the first element in a C array typically starts at:

a)

1

b)

-1

c)

0

d)

Any value

31.

What is the correct declaration of an array of five integers?

a)

int numbers[5];

b)

int numbers(5);

c)

array int numbers[5];

d)

int[5] numbers = {};

32.

Given int numbers[5] = {10, 20};, the remaining elements are:

a)

Unchanged

b)

Random values

c)

All set to 0

d)

All set to -1

33.

If array size is omitted and initialized as int numbers[] = {10,20,30};, the array size becomes:

a)

2

b)

3

c)

0

d)

4

34.

Accessing the third element of numbers uses:

a)

numbers(3)

b)

numbers[2]

c)

*numbers + 3

d)

&numbers[3]

35.

To traverse and print elements of an array, the lesson uses:

a)

A switch statement

b)

A for loop iterating over indices

c)

A goto label

d)

A recursive function

36.

In fixed‑size arrays, 'insertion' typically:

a)

Increases the array's capacity

b)

Overwrites an existing element at a given index

c)

Requires realloc by default

d)

Is not possible in C

37.

Deleting an element from an array is commonly simulated by:

a)

Setting the index to NULL

b)

Shifting subsequent elements left

c)

Freeing the array

d)

Setting array size smaller

38.

The search example in the lesson returns -1 when:

a)

The target is found

b)

The target is not found

c)

The array is full

d)

The array contains 0

39.

Regarding memory layout, consecutive int elements differ in addresses by:

a)

1 byte

b)

2 bytes

c)

4 bytes

d)

8 bytes

40.

The relationship between arrays and pointers shown in the lesson implies that int *ptr = numbers; then *(ptr + 1) equals:

a)

numbers[0]

b)

numbers[1]

c)

numbers[2]

d)

The address of numbers