wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming for Compliance

Total questions: 100

Worksheet time: 51mins

Name
Class
Date
1.

What is an algorithm?

a)

A programming language

b)

A set of ordered steps to solve a problem

c)

A compiler

d)

A flowchart symbol

2.

Which flowchart symbol represents a decision?

a)

Oval

b)

Rectangle

c)

Diamond

d)

Parallelogram

3.

What symbol is used for input/output in a flowchart?

a)

Oval

b)

Diamond

c)

Rectangle

d)

Parallelogram

4.

Which comes first in program development?

a)

Coding

b)

Testing

c)

Problem analysis

d)

Debugging

5.

A flowchart terminal symbol indicates:

a)

Input

b)

Processing

c)

Start/End

d)

Decision

6.

Which best describes a program?

a)

A machine

b)

A set of instructions written in a language

c)

A compiler

d)

An algorithm diagram

7.

What does debugging mean?

a)

Writing code

b)

Finding and fixing errors

c)

Running the program

d)

Compiling code

8.

Which is a high-level language?

a)

Assembly

b)

Machine code

c)

C++

d)

Binary

9.

What is the output of an algorithm?

a)

Input

b)

Process

c)

Result

d)

Variable

10.

Which is NOT a characteristic of a good algorithm?

a)

Finite

b)

Clear

c)

Ambiguous

d)

Step-by-step

11.

Flowcharts are mainly used to:

a)

Write code

b)

Execute programs

c)

Visualize program logic

d)

Store data

12.

Which flowchart symbol represents processing?

a)

Oval

b)

Rectangle

c)

Diamond

d)

Circle

13.

An algorithm must always:

a)

Be written in C++

b)

End after a finite number of steps

c)

Use variables

d)

Use loops

14.

What is pseudocode?

a)

Actual code

b)

Programming language

c)

Informal description of an algorithm

d)

Compiler output

15.

Which step follows problem analysis?

a)

Debugging

b)

Coding

c)

Testing

d)

Maintenance

16.

Flowcharts help programmers to:

a)

Increase errors

b)

Reduce clarity

c)

Understand logic

d)

Replace code

17.

Which of the following is NOT an input device?

a)

Keyboard

b)

Mouse

c)

Monitor

d)

Scanner

18.

What does IPO stand for?

a)

Input–Process–Output

b)

Internal Program Operation

c)

Input–Program–Order

d)

Instruction–Process–Output

19.

Which is an example of input?

a)

Displaying result

b)

User typing numbers

c)

Printing output

d)

Calculating sum

20.

Which is an example of output?

a)

cin

b)

Variable

c)

cout

d)

Compiler

21.

Which symbol ends a C++ statement?

a)

:

b)

.

c)

;

d)

,

22.

Which header file is used for input/output?

a)

stdlib.h

b)

iostream

c)

string.h

d)

conio.h

23.

Which is a valid variable name?

a)

2num

b)

total_sum

c)

float

d)

int

24.

What does int represent?

a)

Variable

b)

Constant

c)

Data type

d)

Identifier

25.

Which operator is used for assignment?

a)

==

b)

!=

c)

=

d)

<=

26.

What is the output of cout << 5 + 3;?

a)

53

b)

8

c)

5+3

d)

Error

27.

Which operator is used for modulus?

a)

/

b)

%

c)

*

d)

+

28.

What is the result of 10 % 3?

a)

1

b)

3

c)

0

d)

10

29.

Which data type stores decimal values?

a)

int

b)

char

c)

float

d)

bool

30.

Which keyword declares a constant?

a)

final

b)

static

c)

const

d)

define

31.

What will happen if a constant is changed?

a)

Program runs

b)

Logical error

c)

Compilation error

d)

Runtime error

32.

Which operator compares two values for equality?

a)

=

b)

!=

c)

==

d)

>=

33.

Which of the following is a string literal?

a)

Hello

b)

'Hello'

c)

"Hello"

d)

hello()

34.

What does cin do?

a)

Displays output

b)

Takes input

c)

Declares variable

d)

Ends program

35.

Which escape sequence is for newline?

a)

\t

b)

\n

c)

\0

d)

\

36.

Which operator sends output to the screen?

a)

>>

b)

<<

c)

::

d)

&&

37.

What is the value of 7 / 2 in C++ (int)?

a)

3.5

b)

4

c)

3

d)

Error

38.

Which is a valid constant declaration?

a)

const x = 5;

b)

const int x = 5;

c)

int const = 5;

d)

constant int x = 5;

39.

What is the size of double?

a)

2 bytes

b)

4 bytes

c)

8 bytes

d)

16 bytes

40.

Which namespace contains cout and cin?

a)

system

b)

main

c)

std

d)

io

41.

Which statement is used for decision making?

a)

for

b)

while

c)

if

d)

break

42.

Which keyword executes code when condition is false?

a)

else

b)

switch

c)

break

d)

continue

43.

What does a switch statement evaluate?

a)

Boolean

b)

Integer/char

c)

String

d)

Float only

44.

Which keyword exits a switch case?

a)

exit

b)

stop

c)

break

d)

continue

45.

Which loop runs at least once?

a)

for

b)

while

c)

do-while

d)

if

46.

Which loop is best when iterations are known?

a)

while

b)

do-while

c)

for

d)

switch

47.

Which loop checks condition first?

a)

do-while

b)

for

c)

while

d)

All loops

48.

Which keyword skips the current loop iteration?

a)

break

b)

exit

c)

continue

d)

return

49.

Infinite loop occurs when:

a)

Condition is false

b)

Condition never changes

c)

Loop has break

d)

Loop ends

50.

What is nesting?

a)

Loop inside loop

b)

Function call

c)

Variable declaration

d)

Comment

51.

Which operator checks AND condition?

a)

||

b)

&&

c)

!

d)

==

52.

What is the output of: for(int i=1;i<=3;i++) cout<<"*";

a)

*

b)

**

c)

***

d)

Error

53.

Which loop is entry-controlled?

a)

do-while

b)

for

c)

while

d)

B and C

54.

Which statement immediately exits a loop?

a)

continue

b)

break

c)

return

d)

goto

55.

What is the output of: int x=5; if(x>3) cout<<"Yes";

a)

Yes

b)

No

c)

Error

d)

Nothing

56.

Which structure is best for menu choices?

a)

for

b)

while

c)

if only

d)

switch

57.

Logical NOT operator is:

a)

!

b)

&&

c)

||

d)

==

58.

What is the output of: int i=1; while(i<=2){ cout<

a)

12

b)

21

c)

1

d)

Error

59.

Which loop is exit-controlled?

a)

for

b)

while

c)

do-while

d)

switch

60.

Which condition is correct for range 1–10?

a)

x>1 || x<10

b)

x>=1 && x<=10

c)

x==1 && x==10

d)

x<1 && x>10

61.

Nested if means:

a)

Multiple switches

b)

if inside if

c)

Loop inside if

d)

Function inside if

62.

Which statement is optional in switch?

a)

case

b)

break

c)

switch

d)

expression

63.

Which causes fall-through in switch?

a)

break

b)

continue

c)

missing break

d)

return

64.

What does return do?

a)

Ends program only

b)

Returns value from function

c)

Ends loop

d)

Skips iteration

65.

Which is NOT a loop?

a)

for

b)

while

c)

do-while

d)

if

66.

What is a function?

a)

A variable

b)

A reusable block of code

c)

A data type

d)

A loop

67.

Which keyword defines no return value?

a)

null

b)

empty

c)

void

d)

none

68.

Which part contains executable statements?

a)

Header

b)

Prototype

c)

Body

d)

Parameter list

69.

What is a function prototype?

a)

Function call

b)

Function body

c)

Function declaration

d)

Function execution

70.

Which function returns an integer?

a)

void display()

b)

int sum()

c)

float avg()

d)

char show()

71.

What is the default argument passing in C++?

a)

Call by reference

b)

Call by pointer

c)

Call by value

d)

Call by address

72.

What symbol encloses function body?

a)

()

b)

[]

c)

{}

d)

<>

73.

Which allows a function to modify original variable?

a)

Call by value

b)

Call by reference

c)

Return statement

d)

Void function

74.

Which function call is valid if default parameter exists?

a)

sum()

b)

sum(5)

c)

sum(5,10,20)

d)

sum(int)

75.

What is function overloading?

a)

Same name, different parameters

b)

Same name, same parameters

c)

Different name, same body

d)

Multiple returns

76.

Which is NOT a benefit of functions?

a)

Reusability

b)

Modularity

c)

Readability

d)

Increased errors

77.

Which is a valid prototype?

a)

int add(int,int);

b)

int add(int,int);

c)

int add(int a b);

d)

int add();int

78.

Which function swaps values correctly using reference?

a)

swap(int x,int y)

b)

swap(int &x,int &y)

c)

swap(int *x,int y)

d)

swap(int x)

79.

What happens if a function is declared but not defined?

a)

Runtime error

b)

Compilation error (if used)

c)

No error

d)

Infinite loop

80.

Which function design is best practice?

a)

One long main

b)

Modular functions

c)

No functions

d)

Only library functions

81.

Which part ensures function uniqueness?

a)

Return type

b)

Function name only

c)

Parameter list only

d)

Name + parameters

82.

Which function computes area correctly?

a)

void area()

b)

int area(int l,int w){return l*w;}

c)

float area()

d)

area(int,int)

83.

What does recursion mean?

a)

Looping

b)

Function calling itself

c)

Nested loops

d)

Repetition without condition

84.

Which keyword sends control back to caller?

a)

break

b)

continue

c)

return

d)

exit

85.

Which function has no parameters and no return value?

a)

void f()

b)

int f(int)

c)

float f()

d)

char f(int)

86.

What is scope?

a)

Memory size

b)

Visibility of variables

c)

Speed of program

d)

Compiler option

87.

Local variables are declared:

a)

Outside all functions

b)

Inside a function

c)

In header file

d)

Globally only

88.

Which variable can be accessed anywhere?

a)

Local

b)

Static

c)

Global

d)

Temporary

89.

What happens after return executes?

a)

Loop continues

b)

Function ends

c)

Program restarts

d)

Variable resets

90.

Which is a valid function call?

a)

sum;

b)

sum();

c)

int sum();

d)

call sum;

91.

Which function is best for calculations?

a)

void

b)

int

c)

char

d)

bool

92.

Which function returns decimal average?

a)

int avg()

b)

void avg()

c)

float avg()

d)

char avg()

93.

Which design improves readability?

a)

Nested main

b)

Modular functions

c)

Global variables only

d)

Long code blocks

94.

What is the main purpose of functions?

a)

Increase code length

b)

Avoid loops

c)

Organize and reuse code

d)

Replace main

95.

Which keyword defines a function?

a)

function

b)

def

c)

return

d)

Data type

96.

Which is NOT part of function definition?

a)

Return type

b)

Function name

c)

Parameter list

d)

Loop condition

97.

Which function call is invalid?

a)

add(2,3)

b)

add()

c)

add(2) (if 2 params required)

d)

add(5,6)

98.

Which is correct about void functions?

a)

Return values

b)

Cannot use return

c)

Do not return values

d)

Cannot print

99.

Which function design is best for large programs?

a)

Single file

b)

Modular approach

c)

One function

d)

No comments

100.

Which best describes structured programming?

a)

Random coding

b)

Use of goto

c)

Use of functions and control structures

d)

No planning