WorksheetsProgramming for Compliance
Total questions: 100
Worksheet time: 51mins
What is an algorithm?
A programming language
A set of ordered steps to solve a problem
A compiler
A flowchart symbol
Which flowchart symbol represents a decision?
Oval
Rectangle
Diamond
Parallelogram
What symbol is used for input/output in a flowchart?
Oval
Diamond
Rectangle
Parallelogram
Which comes first in program development?
Coding
Testing
Problem analysis
Debugging
A flowchart terminal symbol indicates:
Input
Processing
Start/End
Decision
Which best describes a program?
A machine
A set of instructions written in a language
A compiler
An algorithm diagram
What does debugging mean?
Writing code
Finding and fixing errors
Running the program
Compiling code
Which is a high-level language?
Assembly
Machine code
C++
Binary
What is the output of an algorithm?
Input
Process
Result
Variable
Which is NOT a characteristic of a good algorithm?
Finite
Clear
Ambiguous
Step-by-step
Flowcharts are mainly used to:
Write code
Execute programs
Visualize program logic
Store data
Which flowchart symbol represents processing?
Oval
Rectangle
Diamond
Circle
An algorithm must always:
Be written in C++
End after a finite number of steps
Use variables
Use loops
What is pseudocode?
Actual code
Programming language
Informal description of an algorithm
Compiler output
Which step follows problem analysis?
Debugging
Coding
Testing
Maintenance
Flowcharts help programmers to:
Increase errors
Reduce clarity
Understand logic
Replace code
Which of the following is NOT an input device?
Keyboard
Mouse
Monitor
Scanner
What does IPO stand for?
Input–Process–Output
Internal Program Operation
Input–Program–Order
Instruction–Process–Output
Which is an example of input?
Displaying result
User typing numbers
Printing output
Calculating sum
Which is an example of output?
cin
Variable
cout
Compiler
Which symbol ends a C++ statement?
:
.
;
,
Which header file is used for input/output?
stdlib.h
iostream
string.h
conio.h
Which is a valid variable name?
2num
total_sum
float
int
What does int represent?
Variable
Constant
Data type
Identifier
Which operator is used for assignment?
==
!=
=
<=
What is the output of cout << 5 + 3;?
53
8
5+3
Error
Which operator is used for modulus?
/
%
*
+
What is the result of 10 % 3?
1
3
0
10
Which data type stores decimal values?
int
char
float
bool
Which keyword declares a constant?
final
static
const
define
What will happen if a constant is changed?
Program runs
Logical error
Compilation error
Runtime error
Which operator compares two values for equality?
=
!=
==
>=
Which of the following is a string literal?
Hello
'Hello'
"Hello"
hello()
What does cin do?
Displays output
Takes input
Declares variable
Ends program
Which escape sequence is for newline?
\t
\n
\0
\
Which operator sends output to the screen?
>>
<<
::
&&
What is the value of 7 / 2 in C++ (int)?
3.5
4
3
Error
Which is a valid constant declaration?
const x = 5;
const int x = 5;
int const = 5;
constant int x = 5;
What is the size of double?
2 bytes
4 bytes
8 bytes
16 bytes
Which namespace contains cout and cin?
system
main
std
io
Which statement is used for decision making?
for
while
if
break
Which keyword executes code when condition is false?
else
switch
break
continue
What does a switch statement evaluate?
Boolean
Integer/char
String
Float only
Which keyword exits a switch case?
exit
stop
break
continue
Which loop runs at least once?
for
while
do-while
if
Which loop is best when iterations are known?
while
do-while
for
switch
Which loop checks condition first?
do-while
for
while
All loops
Which keyword skips the current loop iteration?
break
exit
continue
return
Infinite loop occurs when:
Condition is false
Condition never changes
Loop has break
Loop ends
What is nesting?
Loop inside loop
Function call
Variable declaration
Comment
Which operator checks AND condition?
||
&&
!
==
What is the output of: for(int i=1;i<=3;i++) cout<<"*";
*
**
***
Error
Which loop is entry-controlled?
do-while
for
while
B and C
Which statement immediately exits a loop?
continue
break
return
goto
What is the output of: int x=5; if(x>3) cout<<"Yes";
Yes
No
Error
Nothing
Which structure is best for menu choices?
for
while
if only
switch
Logical NOT operator is:
!
&&
||
==
What is the output of: int i=1; while(i<=2){ cout<
12
21
1
Error
Which loop is exit-controlled?
for
while
do-while
switch
Which condition is correct for range 1–10?
x>1 || x<10
x>=1 && x<=10
x==1 && x==10
x<1 && x>10
Nested if means:
Multiple switches
if inside if
Loop inside if
Function inside if
Which statement is optional in switch?
case
break
switch
expression
Which causes fall-through in switch?
break
continue
missing break
return
What does return do?
Ends program only
Returns value from function
Ends loop
Skips iteration
Which is NOT a loop?
for
while
do-while
if
What is a function?
A variable
A reusable block of code
A data type
A loop
Which keyword defines no return value?
null
empty
void
none
Which part contains executable statements?
Header
Prototype
Body
Parameter list
What is a function prototype?
Function call
Function body
Function declaration
Function execution
Which function returns an integer?
void display()
int sum()
float avg()
char show()
What is the default argument passing in C++?
Call by reference
Call by pointer
Call by value
Call by address
What symbol encloses function body?
()
[]
{}
<>
Which allows a function to modify original variable?
Call by value
Call by reference
Return statement
Void function
Which function call is valid if default parameter exists?
sum()
sum(5)
sum(5,10,20)
sum(int)
What is function overloading?
Same name, different parameters
Same name, same parameters
Different name, same body
Multiple returns
Which is NOT a benefit of functions?
Reusability
Modularity
Readability
Increased errors
Which is a valid prototype?
int add(int,int);
int add(int,int);
int add(int a b);
int add();int
Which function swaps values correctly using reference?
swap(int x,int y)
swap(int &x,int &y)
swap(int *x,int y)
swap(int x)
What happens if a function is declared but not defined?
Runtime error
Compilation error (if used)
No error
Infinite loop
Which function design is best practice?
One long main
Modular functions
No functions
Only library functions
Which part ensures function uniqueness?
Return type
Function name only
Parameter list only
Name + parameters
Which function computes area correctly?
void area()
int area(int l,int w){return l*w;}
float area()
area(int,int)
What does recursion mean?
Looping
Function calling itself
Nested loops
Repetition without condition
Which keyword sends control back to caller?
break
continue
return
exit
Which function has no parameters and no return value?
void f()
int f(int)
float f()
char f(int)
What is scope?
Memory size
Visibility of variables
Speed of program
Compiler option
Local variables are declared:
Outside all functions
Inside a function
In header file
Globally only
Which variable can be accessed anywhere?
Local
Static
Global
Temporary
What happens after return executes?
Loop continues
Function ends
Program restarts
Variable resets
Which is a valid function call?
sum;
sum();
int sum();
call sum;
Which function is best for calculations?
void
int
char
bool
Which function returns decimal average?
int avg()
void avg()
float avg()
char avg()
Which design improves readability?
Nested main
Modular functions
Global variables only
Long code blocks
What is the main purpose of functions?
Increase code length
Avoid loops
Organize and reuse code
Replace main
Which keyword defines a function?
function
def
return
Data type
Which is NOT part of function definition?
Return type
Function name
Parameter list
Loop condition
Which function call is invalid?
add(2,3)
add()
add(2) (if 2 params required)
add(5,6)
Which is correct about void functions?
Return values
Cannot use return
Do not return values
Cannot print
Which function design is best for large programs?
Single file
Modular approach
One function
No comments
Which best describes structured programming?
Random coding
Use of goto
Use of functions and control structures
No planning
