What will be output of following program?
#include
#include
int main(){
register a = 25;
int far *p;
p=&a;
printf("%d ",*p);
return 0;
}
25
4
Address
Compilation error
Answer: Option D.
The prefix of (X+Y)*(C-D) is
+- XY*CD
*+-XYCD
+XY-CD
*XY+CD
Answer: Option C.
What will be output of following program?
#include
#include
int main(){
char far *p,*q;
printf("%d %d",sizeof(p),sizeof(q));
return 0;
}
2 2
4 4
4 2
2 4
Answer: Option B.
Study the following program written in a block-structured language:
var x, y : integer;
procedure P(n:integer);
begin
x: = (n + 2) / (n - 3); end;
procedure Q
var x, y : integer;
begin
x: = 3;
y: = 4;
P(y);
Write (x) ...(1)
end;
begin
x: = 7; y: = 8;
Write (x) ...(2)
end
What will be printed by write statements marked (1) and (2) in the program if variables are statically scoped?
3, 6
6, 7
3,7
None of these
Answer: Option A.
Consider the following program in a language that has dynamic scooping
var x: real;
procedure show:
begin print(x);end;
procedure small;
var x: real;
begin x: = 0.125; show; end;
begin
x:=0.25
show; small
end.
Then the output of the program is:
The value of j at the end of the execution of the following C program ____________
intincr (int i)
{
staticint count = 0;
count = count + i;
return (count);
}
main () {
int i, j;
for (i = 0; i <= 4; i++)
j = incr (i);
}