Quick Test on Printf

Here is a quick  test  before starting new chapter on C ? Please note that each output answer option is at the end markes as ***************** which also part of printf() command

Go back

Your message has been sent

Warning
Warning
Warning
Warning

Warning.

This is the basic test of printf command for beginners

1. What output you expect from following code ?

/******************************************/

printf(“test0 \r\n”);
printf(“test12 \r”);
printf(“test3 \n”);
printf(“test4 \n”);
printf(“test5 \t”);
printf(“test6 \r\n”);
printf(“test78 \r”);
printf(“***********************\r\n”);

Select one of the answer from : 

 

 
 
 
 

2. You might have noticed that printf without \n doesn’t appear in the output. What should be the command to make sure output appears on the console ?

 
 
 
 

3. What should be output of following ?

printf(“%-+5.3f \n”, 20.1356); //Left justify ,sign,width
printf(“%-+5.3f \n”, -20.1356);
printf(“%-#5.3e \n”, 20.1356);
printf(“%-5.3f \n”, -20.1356);
printf(“%-#10.2x \n”, 144);//left justify
printf(“%010x \n”, 144); //right justify with leading zeros
printf(“%-010x \n”, 144); //left justify
printf(“***********************\r\n”);

Select one of the answer from : 

 
 
 
 

Question 1 of 3

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top

Discover more from

Subscribe now to keep reading and get access to the full archive.

Continue reading