Congratulations - you have completed C Programming : Multiple Choice Questions.
You scored %%SCORE%% out of %%TOTAL%%.
Your performance has been rated as %%RATING%%
Your answers are highlighted below.
Question 1 |
Local Variable is having _______ scope ?
local | |
inter program | |
only inside current Program | |
global |
Question 2 |
Outer Block Only | |
Inner Block Only | |
In Complete Program | |
Inner Block and Outer block |
Question 3 |
Local Variable is Accessible in - [Select Appropriate Option(s)]
From function | |
From Main | |
From block in which it is declared | |
None of these |
Question 4 |
Higher priority is given to ________ variable than _______ variable.
Local , Global | |
Global , Local |
Question 5 |
Inner Block can access variables declared ___________.
inside Outer Block | |
None of these | |
inside Same Block | |
inside Inner Block |
Question 5 Explanation:
Inner Block can access variables declared inside Outer Block.
Question 6 |
What will be the output of the following program ?
#include<stdio.h> void main() { int var1=10; { int var2 = 20; printf("%d %d",var1,var2); } printf("%d %d",var1,var2); }
Compile Time Error | |
10 20 10 20 | |
Run Time Error | |
10 20 10 garbage |
Question 6 Explanation:
Outer block can’t access variables declared inside Inner Block.
Question 7 |
Guess output of program -
#include<stdio.h> void main() { int var1=10; { int var1 = 20; printf("%d %d",var1,var1); } printf("%d %d",var1,var1); }
20 10 20 10 | |
10 10 20 20 | |
10 20 10 20 | |
20 20 10 10 |
Question 7 Explanation:
If same variable is declared inside inner as well as outer block then higher priority will be given to inner block.
Question 8 |
Can we declare same variable inside the inner and outer block ?
Yes, It is possible | |
No , It will give compile error | |
Duplicate Variable is not allowed in C Program | |
None of these |
Question 9 |
In order to create a local variable we need to use local keyword.
local int var;
True | |
False |
Question 10 |
Local variables only exist inside the specific function that creates them. They are unknown to other functions and to the main program
False | |
True |
Question 11 |
Local Variables are generally implemented using _________.
None of these | |
Stack | |
Queue | |
Linked List |
Question 12 |
Local Variables are recreated each time when function is executed or called !
True | |
False |
Once you are finished, click the button below. Any items you have not completed will be marked incorrect.
There are 12 questions to complete.