NEW
Font size
WorksheetsC Module 1
Total questions: 37
Worksheet time: 19mins
Which of the following is the correct order of steps in problem-solving using programming?
Flowchart → Algorithm → Coding
Problem Definition → Algorithm → Flowchart → Coding
Pseudo code → Debugging → Coding
Design → Testing → Compilation
What does a flowchart use to represent a decision?
Rectangle
Diamond
Parallelogram
Circle
Which of these is not a characteristic of structured programming?
Use of sequence
Use of selection
Use of GOTO statements
Use of modularity
Which of the following is not a component of pseudo code?
Logical steps
Conditions
Syntax-specific keywords
Loops
The main advantage of using algorithms is:
Easy to understand problem logic
Requires less memory
Does not need programming skills
Avoids compilation errors
Which of the following is a valid variable name in C?
1value
my-value
value1
#value
Which keyword is used to define a constant in C?
const
#define
static
fixed
What will be the size of int data type in a 32-bit system?
8 bytes
4 bytes
2 bytes
1 byte
Which of these is not a valid C data type?
int
float
real
char
The correct syntax for reading input using scanf is:
scanf("%d", &a);
scan("%d", &a);
scanf("%d", &&a);
input("%d", &a);
Which control structure is used to make decisions in C?
for
if
while
loop
How many times will the loop run?
for(int i = 0; i < 5; i++)
printf("%d", i);
5
6
infinite
4
Which loop will execute at least once, even if the condition is false?
for
while
do-while
None
Which of the following is not a loop control statement in C?
break
continue
switch
goto
Which keyword is used to declare a function in C?
def
return-type + name
function
void
What is the default return type of a function in C if not specified?
int
float
void
char
Function calling by reference allows:
Changes in actual values
Faster execution
Only reading data
Copy of variable to function
What is the output of the recursive function called with n=3:
void fun(int n){
if(n>0){
fun(n-1);
printf("%d", n);
}
}
321
123
None above
Error
What is the scope of a static variable inside a function?
Global
Local but retains value
Public
Shared across all functions
Which of the following declares a 1D array of 10 integers?
int arr();
int arr[10];
int arr[10][10];
int arr{};
Indexing of array elements starts from:
1
0
-1
2
What is the correct way to initialize a string in C?
char str[10] = {'H','i'};
char str[] = {Hi};
char str[] = "Hi";
char str = "Hi";
Which function is used to find the length of a string?
strlen()
size()
length()
strlen()
Which function is used to concatenate two strings in C?
strcat()
strcpy()
strcat()
stradd()
What is the output of printf("%s", str); if str = "C Programming";
str
C Programming
C
Error
What is a pointer in C?
Variable storing data
Variable storing address of another variable
Function return value
Array name
Which symbol is used to declare a pointer?
&
%
***
#
Which operator gives the address of a variable?
*
&
@
%
Which keyword is used to define a structure in C?
struct
structure
class
object
Which of the following is true about union in C?
All members can hold values simultaneously
Only one member can hold value at a time
It's similar to array
None
Which keyword is used with structures to define a custom name?
struct
typedef
alias
define
How is a member of a structure accessed?
struct.member
structure->member
structure.member
member.structure
Which structure is inside another structure?
Static structure
Nested structure
Recursive structure
Multi structure
Which function is used to open a file in C?
openfile()
fopen()
startfile()
createfile()
Which mode is used to read a file?
"rw"
"w"
"r"
"a"
Which data type is used to define a file pointer?
int
void
FILE*
file
What does fclose() do?
Closes the opened file
Opens a file
Reads file data
Moves file pointer
