26) main()
{
clrscr();
}
clrscr();
Answer:
No
output/error
Explanation:
The first
clrscr() occurs inside a function. So it becomes a function call. In the second
clrscr(); is a function declaration (because it is not inside any function).
27) enum
colors {BLACK,BLUE,GREEN}
main()
{
printf("%d..%d..%d",BLACK,BLUE,GREEN);
return(1);
}
Answer:
0..1..2
Explanation:
enum
assigns numbers starting from 0, if not explicitly defined.
28) void
main()
{
char far *farther,*farthest;
printf("%d..%d",sizeof(farther),sizeof(farthest));
}
Answer:
4..2
Explanation:
the
second pointer is of char type and not a far pointer
29) main()
{
int i=400,j=300;
printf("%d..%d");
}
Answer:
400..300
Explanation:
printf
takes the values of the first two assignments of the program. Any number of
printf's may be given. All of them take only the first two values. If more
number of assignments given in the program,then printf will take garbage
values.
30)
main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
}
Answer:
H
Explanation:
* is a
dereference operator & is a reference
operator. They can be applied
any number of times provided it is meaningful. Here p points to
the first character in the string "Hello". *p dereferences it
and so its value is H. Again &
references it to an address and * dereferences it to the value H.
No comments:
Post a Comment