Function: GATE CS Previous Year Questions

Function · Programming in C

68 questions · asked in 26 of 27 years (2000–2026)

MCQ 47 · NAT 211-mark 35 · 2-mark 33

2000Questions per year2026

Questions 66–68 of 68

Q66GATE 20011 markMCQ−0.33 if wrong
Consider the following program
 Program P2 
    var n: int: 
     procedure W(var x: int) 
     begin 
         x=x+1; 
         print x;   
     end 

     procedure D 
     begin  
         var n: int; 
         n=3; 
         W(n);  
     end 
begin //beginP2 
  n=10; 
  D; 
end 
If the language has dynamic scooping and parameters are passed by reference, what will be printed by the program ?

Q67GATE 20011 markMCQ−0.33 if wrong
What is printed by the print statements in the program P1 assuming call by reference parameter passing ?
 Program P1()
{
   x = 10;
   y = 3;
   func1(y,x,x);
   print x;
   print y;
}
func1(x,y,z)
{
   y = y+4;
   z = x+y+z;
}

Q68GATE 20001 markMCQ−0.33 if wrong
The value of j at the end of the execution of the following C program:
 int incr (int i)
{ 
    static int count = 0;
    count = count + i;
    return (count);
} 
main () { 
    int i, j; 
    for (i = 0; i <= 4; i++)
       j = incr (i);
} 
is:

Keep practising

Topics in Programming in C

All CS topics ›