Discover the depth  of  C

  C C++  Linux ProgrammingNEW   Operating Systems  Data StructuresNEW  Compilers  Contact Us

Navigation

Join C4SwimmersGroup

 sitepromotion.gif (577 bytes) New Member

Test Your C/C++ Skills

  Playing with printf

  Playing with scanf

  Branching & Loops

  Functions

  Pointers Part I

  Pointers Part II

  Structure & Union

C Special

  Discovering C
  Exploring C Part I
  Exploring C Part II
  IFAQs

Programming Problems

  Part I
  Part II
 post-question_icon.gif (1062 bytes) Useful C/C++ Links
Downloads
C4S - Solution Pack
Data Structures
C++ & 8086 ALP
ADA & System S/w
Online Certifications
premiumservices.gif (1070 bytes) Brainbench
premiumservices.gif (1070 bytes) Benchmarks Global
Help and Support
customer_care_small.gif (1018 bytes) Suggestions
post-question_icon.gif (1062 bytes) Contribute
premiumservices.gif (1070 bytes) Feedback
premiumservices.gif (1070 bytes) Advertise with us
 

 memberhome.gif (1052 bytes) -Home Page-

 
 
.  

C For Swimmers : Mastering C step-by-step

Google


WWW c4swimmers.esmartguy.com
NOTE : It is assumed that -

Necessary header files are included
Programs/Snippets are tested under Linux as well as Windows platform
Programs/Snippets are compiled using VC++ 6.0 as well as gcc 3.2
The underlying machine is an x86 system

Weekly Queries : Week 3 : June 2005

 [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

You are Visitor No.

Sign my Guestbook View my Guestbook


Subscribe to C4Swimmers Group
Designed and Maintained by  Nanda Kishor

Make money from your website

Thanks for using C For Swimmers.
Regarding this material, you can send Bug Reports, Suggestions, Comments, etc. to

nandakishorkn@rediffmail.com

TheFreeSite.com!

Note: All logos or trademarks are related to their respective owners.

Although every precaution has been taken, the designer(s) owe no responsibility for malicious errors.

No liability assumed for damages resulting from the use of the available information.