Variable Declaration And Scope

8 Questions | Attempts: 110
Share
Please wait...
Question 1 / 8
0 %
0/100
Score 0/100
1. #include <stdio.h> extern int var; int main() {     var = 10;     printf("%d ", var);     return 0; }
Submit
Please wait...
About This Quiz
Variable Declaration And Scope - Quiz

Tell us your name to personalize your report, certificate & get on the leaderboard!
2. Consider the following C program, which variable has the longest scope?
int a; int main() {    int b;    // ..   // ..} int c; 
Submit
3. Output?
#include <stdio.h> int main() {   int x = 1, y = 2, z = 3;   printf(" x = %d, y = %d, z = %d \n", x, y, z);   {        int x = 10;        float y = 20;        printf(" x = %d, y = %f, z = %d \n", x, y, z);        {              int z = 100;              printf(" x = %d, y = %f, z = %d \n", x, y, z);        }   }   return 0; }
Submit
4. #include <stdio.h> extern int var = 0; int main() {     var = 10;     printf("%d ", var);     return 0; }
Submit
5. Output?
int main() {   {       int var = 10;   }   {       printf("%d", var);    }   return 0; }
Submit
6. Consider the following two C lines
int var1; extern int var2;
Which of the following statements is correct
Submit
7. Int main() {   int x = 032;   printf("%d", x);   return 0; }
Submit
8. Predict the output
#include <stdio.h> int var = 20; int main() {     int var = var;     printf("%d ", var);     return 0; } 
Submit
View My Results

Quiz Review Timeline (Updated): Dec 23, 2014 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Dec 23, 2014
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 23, 2014
    Quiz Created by
    Jawahar Ganesh
Cancel
  • All
    All (8)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
#include <stdio.h> extern int var; int...
Consider the following C program, which variable has the longest...
Output?#include <stdio.h> int...
#include <stdio.h> extern int var = 0; int...
Output?int...
Consider the following two C linesint var1; extern int var2;Which...
Int main() {   int x =...
Predict the output#include <stdio.h> int var = 20; int...
Alert!

Advertisement