Discover the depth  of  C

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

Navigation

?? Interview Questions ??New

Join C4Swimmers

 sitepromotion.gif (577 bytes) New Member

Weekly Queries New

 Queries for this week

 All Weekly Queries

Code Zone - Free

Newbie Level

Intermediate Level

Tools Zone

C/C++ Tools

Test Your C/C++ Skills

  Playing with printf

  Playing with scanf

  Branching & Loops

  Pointers Part I

  Pointers Part II

  Structure & Union

C Special

  Discovering C
  IFAQs

  Self-reproducing C Code

  C/C++ Links
  C/C++ Books NEW

Programming Problems

  Part I
  Part II
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)  Advertise with us
memberhome.gif (1052 bytes)  -Home Page-

premiumservices.gif (1070 bytes) Feedback

As a webmaster of this site, I regard you as our most important critic and commentator. We value your opinion and want to know what we are doing right, what we could do better and any other words of wisdom you're willing to pass our way. It would be our greatest motivation which will help us in developing areas you would like to see in this site. We hope you will continue to encourage and support us in our future endeavors.

 
.  

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

Playing with printf()

 [Q001] What will be the output of the following program :
 int main()
 {
   printf();
   return(0);
 }
 (a)Run-Time Error
 (b)Compile-Time Error
 (c)No Output
 (d)None of these
 [Q002] What will be the output of the following program :
 int main()
 {
   printf(NULL);
   return(0);
 }
 (a)Run-Time Error
 (b)Compile-Time Error
 (c)No Output
 (d)None of these
 [Q003] What will be the output of the following program :
 int main()
 {
   printf("%%",7);
   return(0);
 }
 (a)7
 (b)Compile-Time Error
 (c)%
 (d)%%
 [Q004] What will be the output of the following program :
 int main()
 {
   printf("//",5);
   return(0);
 }
 (a)5
 (b)Compile-Time Error
 (c)/
 (d)//
 [Q005] What will be the output of the following program :
 int main()
 {
   printf("d%",8);
   return(0);
 }
 (a)8
 (b)Compile-Time Error
 (c)d%
 (d)None of these
 [Q006] What will be the output of the following program :
 int main()
 {
   printf("%d"+0,123);
   return(0);
 }
 (a)123
 (b)Compile-Time Error
 (c)No Output
 (d)None of these
 [Q007] What will be the output of the following program :
 int main()
 {
   printf("%d"+1,123);
   return(0);
 }
 (a)123
 (b)Compile-Time Error
 (c)d
 (d)No Output
 [Q008] What will be the output of the following program :
 int main()
 {
   printf("%d",printf("Hi!")+printf("Bye"));
   return(0);
 }
 (a)ByeHi!6
 (b)Hi!Bye6
 (c)Compile-Time Error
 (d)None of these
 [Q009] What will be the output of the following program :
 int main()
 {
   printf("%d",printf("Hi!")*printf("Bye"));
   return(0);
 }
 (a)ByeHi!6
 (b)Hi!Bye9
 (c)Hi!Bye
 (d)None of these
 [Q010] What will be the output of the following program :
 int main()
 {
   printf("%d",printf("")+printf(""));
   return(0);
 }
 (a)0
 (b)No Output
 (c)Compile-Time Error
 (d)None of these
 [Q011] What will be the output of the following program :
 int main()
 {
   printf("Hi Friends"+3);
   return(0);
 }
 (a)Hi Friends
 (b)Friends
 (c)Hi Friends3
 (d)None of these
 [Q012] What will be the output of the following program :
 int main()
 {
   printf("C For ") + printf("Swimmers");
   return(0);
 }
 (a)Compile-Time Error
 (b)C For Swimmers
 (c)Run-Time Error
 (d)None of these
 [Q013] What will be the output of the following program :
 int main()
 {
   printf("\/\*\-*\/");
   return(0);
 }
 (a)Run-Time Error
 (b)\/*-*\/
 (c)/*-*/
 (d)None of these
 [Q014] What will be the output of the following program :
 int main()
 {
   int main=7;
   {
      printf("%d",main);
      return main;
   }
   printf("Bye");
   return(0);
 }
 (a)Compile-Time Error
 (b)Run-Time Error
 (c)7Bye
 (d)7
 [Q015] What will be the output of the following program :
 int main()
 {
   main();
   return(0);
 }
 (a)Compile-Time Error
 (b)Executes ONLY once
 (c)Infinite Loop
 (d)None of these
 [Q016] What will be the output of the following program :
 int main()
 {
   printf("Work" "Hard");
   return(0);
 }
 (a)Work
 (b)Hard
 (c)No Output
 (d)WorkHard
 [Q017] What will be the output of the following program :
 int main()
 {
   char str[]="%d";
   int val=25;
   printf(str,val);
   return(0);
 }
 (a)Compile-Time Error
 (b)Run-Time Error
 (c)25
 (d)None of these
 [Q018] What will be the output of the following program :
 int main()
 {
   int val=75;
   printf("%d",val,.,.);
   return(0);
 }
 (a)Compile-Time Error
 (b)No Output
 (c)75
 (d)None of these
 [Q019] What will be the output of the following program :
 int main()
 {
   int val=10;
   printf("%d",val+1,"%d",val--);
   return(0);
 }
 (a)10
 (b)11 10
 (c)11 9
 (d)10 9
 [Q020] What will be the output of the following program :
 int main()
 {
   int val=5;
   printf("%d %d %d %d",val,--val,++val,val--);
   return(0);
 }
 (a)3 4 6 5
 (b)Compiler Dependant
 (c)4 4 5 5
 (d)None of these
 [Q021] What will be the output of the following program [NOTE : ASSUME 2 values are entered by the user are stored in the variables 'val' & 'num' respectively] :
 int main()
 {
   int val=5,num;
   printf("%d",scanf("%d %d",&val,&num));
   return(0);
 }
 (a)1
 (b)2
 (c)5
 (d)None of these
 [Q022] What will be the output of the following program :
 #define Compute(x,y,z) (x+y-z)
 int main()
 {
   int x=2,y=3,z=4;
   printf("%d",Compute(y,z,(-x+y)) * Compute(z,x,(-y+z)));
   return(0);
 }
 (a)40
 (b)30
 (c)Compile-Time Error
 (d)None of these
 [Q023] What will be the output of the following program :
 int main()
 {
   int m=10,n=20;
   printf("%d %d %d",m/* m-value */,/* n-value */n,m*/* Compute m*n */n);
   return(0);
 }
 (a)Run-Time Error
 (b)10 20 200
 (c)Compile-Time Error
 (d)None of these
 [Q024] What will be the output of the following program :
 int main()
 {
   int m=10,n=20;
   /* printf("%d",m*n);
   return(0);
 }
 (a)VALID but No Output
 (b)VALID : Prints 200
 (c)Compile-Time Error
 (d)None of these
 [Q025] What will be the output of the following program :
 int main()
 {
   int val=97;
   "Printing..."+printf("%c",val);
   return(0);
 }
 (a)Printing...97
 (b)97
 (c)Compile-Time Error
 (d)a
 [Q026] What will be the output of the following program :
 int main()
 {
   int val=5;
   val=printf("C") + printf("Skills");
   printf("%d",val);
   return(0);
 }
 (a)Skills5
 (b)C1
 (c)Compile-Time Error
 (d)CSkills7
 [Q027] What will be the output of the following program :
 int main()
 {
   char str[]="Test";
   if ((printf("%s",str)) == 4)
      printf("Success");
   else
      printf("Failure");
   return(0);
 }
 (a)TestFailure
 (b)TestSuccess
 (c)Compile-Time Error
 (d)Test
 [Q028] What will be the output of the following program :
 int main()
 {
   int val=5;
   printf("%*d",val,val);
   return(0);
 }
 (a)bbbbb5 (where b means blankspace)
 (b)5
 (c)Compile-Time Error
 (d)None of these
 [Q029] What will be the output of the following program :
 int main()
 {
   int val=5;
   printf("%d5",val);
   return(0);
 }
 (a)Compile-Time Error
 (b)5
 (c)55
 (d)bbbbb5 (where b means blankspace)
 [Q030] What will be the output of the following program :
 int main()
 }
   int val=5;
   printf("%d",5+val++);
   return(0);
 {
 (a)Compile-Time Error
 (b)5
 (c)10
 (d)11

Click here to see the Solutions for the above queries.

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.