Interview Questions

CONSOLE IO OPERATIONS

Multiple Choice Questions

1. ________ Header file is included in the program to perform console I/O operation?

 a) stdio.h

 b) conio.h

 c) std.h

 d) std:.h(“word”);

2. Variable number of arguments can be passed to toprintf() library function?

 a) True

 b) False

3. Which data type defines ‘%s’ specifier?

 a) unsigned long

 b) long

 c) char array

 d) string

4. Which of the following is the invalid library function?

 a) printf(“10%d”, 456);

 b) printf(“%10d”, 456);

 c) printf(“%10.2d”, 456.4);

 d) printf(“%d %d”, 456, 454.4);

5. What will be the output of printf(“%06d”, 9876);

 a) 9876

 b) 987600

 c) 009876

 d) 980076

6. Which of the following is correct syntax of scanf ()?

 a) scanf(“format-string”, list of variables);

 b) scanf (“format-string”, list of address of variables);

 c) scanf (“format-string”, variable);

 d) scanf (“format-string”, list of address of operator);

7. What does ‘&’ symbol define in console I/O Function?

 a) assign value to variable

 b) logical operator

 c) address of operator

 d) none of above

8. Which of following is a valid statement?

 a) scanf(“%d, %f, %d” &a, &b, &c);

 b) scanf(“%d”, “%d”, “%d”, &a, &b, &c);

 c) scanf(“%d %f %d”, &a, &b, &c);

 d) All of above

9. Which of the following defines the correct functionality of getchar()?

 a) Assign character without pressing enter key

 b) echo’s character instantly without pressing enter key

 c) Write a single character after pressing enter key

 d) Read a single character after pressing enter key