1. Home
  2. Programming and Data Stru...

Filters

Found 2 Questions

Set Default
Exams
Subjects
Topics

List of top Programming and Data Structures Questions on C Programming: Scope and Variable Shadowing

Consider the following three ANSI-C programs, P1, P2, and P3.
P1:
#include <stdio.h>
int a=5;
int main(){
int a=7;
return(0);
}
P2:
#include <stdio.h>
int main(){
int a=5;
int a=7;
return(0);
}
P3:
#include <stdio.h>
int main(){
int a=5;
float a=7;
return(0);
}
Which one of the following statements is true?
  • GATE CS - 2026
  • GATE CS
  • Programming and Data Structures
  • C Programming: Scope and Variable Shadowing
Consider the following program in C:
#include <stdio.h>

void func(int i, int j) {
  if (i < j) {
    int i = 0;
    while (i < 10) {
      j += 2;
      i++;
    }
  }
  printf("%d", i);
}

int main() {
  int i = 9, j = 10;
  func(i, j);
  return 0;
}
The output of the program is __________. (answer in integer)
Note: Assume that the program compiles and runs successfully.
  • GATE CS - 2026
  • GATE CS
  • Programming and Data Structures
  • C Programming: Scope and Variable Shadowing
contact us
terms & conditions
Privacy & Policy
© 2026 Patronum Web Private Limited