Table of Content

  • Switch Case Multiple Choice Questions

C Programming MCQ : Switch Case Multiple Choice Questions


Question 1
Higher priority is given to ________ variable than _______ variable.
A
Global , Local
B
Local , Global
Question 2
Inner Block can access variables declared ___________.
A
inside Outer Block
B
inside Inner Block
C
None of these
D
inside Same Block
Question 2 Explanation: 
Inner Block can access variables declared inside Outer Block.
Question 3
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);
}
A
10 20 10 garbage
B
Compile Time Error
C
10 20 10 20
D
Run Time Error
Question 3 Explanation: 
Outer block can’t access variables declared inside Inner Block.
Question 4
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);
}
A
20 10 20 10
B
10 20 10 20
C
10 10 20 20
D
20 20 10 10
Question 4 Explanation: 
If same variable is declared inside inner as well as outer block then higher priority will be given to inner block.
Question 5
Can we declare same variable inside the inner and outer block ?
A
No , It will give compile error
B
None of these
C
Duplicate Variable is not allowed in C Program
D
Yes, It is possible
There are 5 questions to complete.