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 |
Global Variable is a Variable that is _________ available.
Globally | |
Locally |
Question 2 |
Scope of Global variable is ___________.
None of these | |
Throughout the program | |
In the Outer Block Only | |
Function in which it is declared |
Question 3 |
Guess the output of the program -
#include<stdio.h> int var=10; void message(); void main() { int var=20; { int var = 30; printf("%d ",var); } printf("%d ",var); message(); } void message() { printf("%d ",var); }
30 10 20 | |
30 20 10 | |
10 30 20 | |
10 20 30 |
Question 4 |
If inside current function block, variable is not defined then compiler look for global copy.
True | |
False |
Question 5 |
Using global variable is bad practice of writing code.
Yes | |
No |
Question 5 Explanation:
Writing global variable is considered as bad practice because of their non-locality and a global variable can potentially be modified from anywhere in the program.
Question 6 |
The use of global variables makes software harder to read and understand.
True | |
False |
Question 7 |
Global Variables are variables declared outside any of the c function !
False | |
Completely True | |
Yes Partially True | |
None of these |
Question 7 Explanation:
Any Variable declared inside function can be considered as global variable from inner block.
Question 8 |
We can declare any number of global variables in a C Program.
False | |
True |
Once you are finished, click the button below. Any items you have not completed will be marked incorrect.
There are 8 questions to complete.