computer MCQs
12th • Chapter 13
49 Questions TextBook
1
What is a self-contained piece of code that performs a specific task?
2
The programming approach of dividing program logic into smaller modules is known as?
A
Unstructured programmingB
Object-oriented programming 3
Which of the following is a primary benefit of using functions?
B
Decreases code reusabilityC
Makes programs easier to understand and maintain 4
Pre-defined functions like printf() and scanf() are packaged in?
5
To use a built-in function in C, you must include the corresponding ___ in your program.
6
Functions that are written by the programmer to solve a specific problem are called?
7
What are the three parts of a function header?
A
Return type, name, bodyC
Return type, name, parametersD
Return type, parameters, body 8
The part of the function where variable declarations and program logic are implemented is called the?
9
Which statement is used to specify the value returned by a function?
10
What is a function prototype?
B
A statement providing basic information about the function to the compilerC
Another name for the function bodyD
The execution of the function 11
A function prototype statement must end with which character?
12
What is the mechanism used to invoke a function to perform a specific task?
13
The duration for which a variable exists in memory is called its?
14
The region of a program in which a variable is accessible is known as its?
15
Variables declared within a block or a function are called?
16
Variables declared outside of all functions are known as?
17
What is the lifetime of a global variable?
A
Until the function in which it is declared endsB
Until the block in which it is declared endsC
Until the program terminatesD
Only for the duration of a loop 18
In the context of function calls, the parameters passed in the function call are known as?
19
The parameters specified in the function header are called?
20
Formal arguments are also known as?
21
What happens to a local variable when the program control moves outside the block in which it is declared?
22
Memory is allocated to a local variable at the time of its?
23
Which of the following looks for the prototypes of functions used in a program?
24
The name of actual and formal parameters?
25
Which of the following is true about a function call?
A
It stops the execution of the programB
It transfers control to the called functionC
It transfers control to the main functionD
It resumes the execution of the program 26
Global variables are created in?
27
Which library contains the definition for printf() and scanf()?
28
In C, how are arguments passed to a function by default?
29
What is the maximum number of values a function can return using a single 'return' statement?
30
The idea of modular programming is inspired by?
31
In a structured program, the main function primarily consists of?
A
A series of function callsB
Countless lines of codeC
Variable declarations only 32
When an error arises in a structured program, it is best to debug?
C
The infected function only 33
The function header `void calculate()` indicates?
A
It returns an int and takes no argumentsB
It returns nothing and takes no argumentsC
It returns a void pointer 34
If a return type is `void`, the function body?
A
Must contain a return statementB
Does not need a return statement 35
Where are function prototypes usually placed?
A
At the end of the source fileB
Inside the main functionC
In a separate .obj fileD
At the beginning of the source file, before main() 36
When a function call is executed, control transfers to?
A
The next line in the calling function 37
The scope of a local variable starts from its point of declaration and ends at?
B
The end of the function callC
The end of the block containing its declaration 38
The variable `chk` in the `if` block of Example 1 (page 212) has what kind of scope?
39
Attempting to refer to a variable outside its scope results in a?
40
What is the value of `nCount` printed at the end of the program in Example 2 (page 214)?
41
In the `Add(int n1, int n2)` function, `n1` and `n2` are?
42
Any change made to the value of a formal parameter ___ affect the value of the actual parameter.
43
A built-in function, once defined by the C standard library,?
A
can be redefined by the userB
cannot be redefined by the userC
must be redefined by the user 44
In a C program, two different functions can have?
A
The same name and same parametersB
The same name but different parametersC
Different names but same parametersD
Both B and C are correct 45
An unstructured program is generally ___ to debug than a structured program.
46
What is the purpose of the function call `clrscr()` used in the examples?
B
To clear the output screenC
To get input from the user 47
In Example 3 (page 215), `Print_Asterisks()` is an example of a function that?
A
Returns a value and accepts argumentsB
Returns a value but accepts no argumentsC
Returns no value and accepts no argumentsD
Returns no value but accepts arguments 48
The main logic of the `Print_Asterisks` function is built using?
49
Which of the following is NOT a benefit of using functions?
A
Ensuring parallel developmentB
Increasing code reusabilityC
Making programs harder to understand