NEW
Font size
WorksheetsProgramming Concepts Quiz
Total questions: 55
Worksheet time: 28mins
The first step in problem-solving using programming is:
Coding
Debugging
Algorithm design
Problem definition
A program written in high-level language must be translated to:
Binary numbers
Source code
Assembly language
Object-oriented code
Which representation uses symbols like ovals, diamonds, and rectangles?
Algorithm
Flowchart
Pseudocode
Source code
The SDLC phase that identifies user needs is:
Implementation
Requirement analysis
Testing
Maintenance
Debugging refers to:
Writing algorithms
Detecting and fixing errors
Translating program
Documentation
Which approach breaks problems into sub-problems?
Bottom-up
Modular approach
Top-down
Sequential
Example of an imperative language:
Python
Prolog
HTML
LISP
In program development, testing ensures:
Syntax correctness
Logical correctness
Machine translation
Variable declarations
Semantic errors occur when:
Grammar rules are broken
Meaning of program is wrong
Compiler cannot parse
Input/output is mismatched
Which is NOT a program development step?
Algorithm design
Flowcharting
Code encryption
Testing
The correct syntax for printing in C is:
print("Hello");
printf("Hello");
cout<<"Hello";
echo("Hello");
The function used for input in C is:
scanf()
input()
read()
cin>>
Which header file is required for printf and scanf?
math.h
conio.h
stdio.h
string.h
In C, the first line executed is inside:
start()
main()
init()
header()
Which symbol is used for format specifier in printf?
#
%
&
$
Syntax error in C is detected at:
Compilation
Execution
Testing
Maintenance
Which escape sequence prints a new line?
\t
\n
\r
\b
To read a character input in C, you use:
getchar()
scanf("%s")
cin>>
gets()
Which error is hardest to detect?
Syntax error
Semantic error
Logical error
Runtime error
Which function is used to clear output screen in C (Turbo C)?
cls()
system("clear")
clrscr()
reset()
Which is not a basic data type in C?
int
char
float
string
The size of an int in most modern systems is:
2 bytes
4 bytes
8 bytes
1 byte
A variable name in C cannot start with:
Alphabet
Underscore
Number
Lowercase letter
Which operator has highest precedence?
*
()
++
%
The modulus operator (%) works only with:
float
char
int
double
User-defined data type is created using:
typedef
define
macro
include
An array is a:
Derived data type
User-defined type
Pointer
Operator
The operator used for logical AND is:
&
&&
and
*
The increment operator increases value by:
1
2
0
10
Expression evaluated first in a+b*c:
a+b
bc
a+c
all left-to-right
If-else is an example of:
Looping
Branching
Jumping
Function call
Which loop checks condition at the end?
for
while
do-while
switch
In a for loop, the update expression is executed:
Before condition
After condition
After each iteration
Only once
A loop inside another loop is called:
Nested loop
Infinite loop
Recursive loop
Do loop
Which statement transfers control unconditionally?
break
continue
goto
return
The switch statement works with:
int, char
float, double
string
all data types
Break statement terminates:
Only inner loop/switch
Entire program
All loops
Compiler
Which statement skips remaining statements in loop iteration?
goto
return
continue
break
An infinite loop occurs when:
Loop never executes
Condition is always false
Condition is always true
No initialization
A decision-making structure is:
for loop
while loop
if-else
array
Which operator is used for conditional expression?
&&
?:
||
%
Which data type is best to store true/false?
int
char
bool
float
Which is not a loop in C?
for
while
repeat-until
do-while
Which phase ensures program meets requirements?
Coding
Testing
Analysis
Maintenance
Variable declared inside a function is:
Global
Static
Local
External
Operator used to access address of a variable:
*
#
&
%
Data type used for single character:
int
float
char
string
Which error stops program from compilation?
Syntax
Logical
Semantic
Runtime
Which of these is NOT part of SDLC?
Coding
Analysis
Compilation
Design
A program that produces wrong results but runs successfully has:
Syntax error
Logical error
Runtime error
Semantic error
Identify the error in the following C statement: printf("Welcome to C Programming);
No error
Missing semicolon
Missing closing double quote
Wrong function name
Which of the following is a semantic error?
Missing semicolon after a statement
Using undeclared variable
Adding an int and a char correctly but meaning is wrong
Unmatched braces { }
Choose the correct syntax for reading an integer in C:
scanf("%d", x);
scanf("%d", &x);
scanf("%d", *x);
scanf("%d", #x);
What does the & symbol in C represent when used with a variable?
Multiplication
Address of variable
Bitwise AND
Dereferencing a pointer
Find the error in the following code snippet: int main() { int a; scanf("%d", a); printf("%d", a); return 0; }
No error
scanf missing & before variable
printf format specifier is wrong
main should not return 0
