| [Q001] What will be the output of the following program
: |
int main()
{
extern int i;
printf("%d",i+5);
return 0;
}
int i;
|
(a)5 (b)Compile-Time Error (c)Linker
Error (d)None of
these |
|
|
| [Q002] What will be the output of the following
program : |
int main()
{
extern int i;
printf("%d",i+9);
return 0;
}
int i=6;
|
(a)9 (b)Compile-Time
Error (c)Linker Error (d)15 (e)None
of these |
|
|
| [Q003] What will be the output of the following program
: |
extern static int i=5;
int main()
{
printf("%d",i);
return 0;
}
int i;
|
(a)Compile-Time
Error (b)5 (c)Linker Error (d)None
of these |
|
|
| [Q004] What will be the output of the following program
: |
static int i=5;
int main()
{
printf("%d",i);
return 0;
}
int i=8;
|
(a)5 (b)8 (c)Compile-Time Error (d)Linker
Error (e)None of these |
|
|
| [Q005] What will be the output of the following program
: |
#define x 3
void foo()
{
#undef x
printf("%d",x+4);
}
int main()
{
printf("%d",x);
foo();
return 0;
}
|
(a)3 (b)37 (c)Compile-Time Error (d)Linker
Error (e)None of these |
|
|
| [Q006] What will be the output of the following program
: |
#define x 4
void foo()
{
#undef x
}
int main()
{
printf("%d",x);
foo();
printf("%d",x+5);
return 0;
}
|
(a)4 (b)49 (c)Compile-Time Error (d)Linker
Error (e)None of these |
|
|
| [Q007] What will be the output of the following
program : |
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
#define FINDMAX(a,b,c) MAX(a,MAX(b,c))
int main()
{
printf("%d",FINDMAX(8,83,46));
return 0;
}
|
(a)8 (b)83 (c)Compile-Time
Error (d)46 (e)Linker Error (f)None of these |
|
|
| [Q008] What will be the output of the following
program : |
#define print(x) printf("y"#x"=%d",y##x)
int main()
{
int y1=25;
print(1);
return 0;
}
|
(a)25 (b)Run-Time Error (c)Compile-Time
Error (d)None of these |
|
|
| [Q009] What will be the output of the following
program : |
#define X 5
#if defined X
#define X 6
#endif
int main()
{
printf("%d",X);
return 0;
}
|
(a)5 (b)6 (c)Linker Error (d)Compile-Time
Error (e)None
of these |
|
|
| [Q010] What will be the output of the following
program : |
#define LINUX 0
#define WINDOWS 1
#define SOLARIS 2
#define OS LINUX
#if OS == LINUX
#define X LINUX
#elif OS == WINDOWS
#define X WINDOWS
#elif OS == SOLARIS
#define X SOLARIS
#else
#define X 3
#endif
int main()
{
printf("%d",X);
return 0;
}
|
(a)1 (b)2 (c)Compile-Time
Error (d)0 (e)None of
these |
|
|
|
Click
Here - SOLUTIONS
- Weekly queries - Week3 - June 2005
|
Send
your feedback about Weekly queries - Week3 - June 2005
section to nandakishorkn@rediffmail.com
|
|
|