Chapter No 10
Input/Output
1. The function getch() is defined in choose which one is correct:
- stdio.h
- string.h
- math.h
- conio.h
2. The escape sequence for backslash is choose which one is correct:
- \
- \b
- \\
- \t
3. function is used to display output on screen choose which one is correct:
- scanf()
- printf()
- get()
- print()
4. The printf() function is used to display choose which one is correct:
- Text
- Constants or values of variables
- Both a & b
- None
5. is not used in control or format string in a printf() function choose which one is correct:
- Text
- escape sequences
- format specifiers
- variables
6. How many variables can be used in one printf() function choose which one is correct?
- Only one
- Two
- Three
- Many
7. is control string in the statement printf(“Result = %d”,r); choose which one is correct:
- %d
- Result = %d
- r
- None
8. The functions used for input and output are stored in header file choose which one is correct:
- conio.h
- math.h
- output.h
- stdio.h
9. is used for flag choose which one is correct:
- +
- –
- Both a and b
- None
10. The format specifier %u is used for choose which one is correct:
- Integer
- Unsigned Short int
- Unsigned float
- Unsigned long int
11. The escape sequence for carriage return is
- \a
- \c
- \r
- \f
12. Which of the following forma specifier is used for character type data
- \c
- %c
- %s
- %ch
13. What will be the output of printf(“%d”,’a’); choose which one is correct?
- 65
- A
- 97
- a
14. format specifiers is used for integer type data choose which one is correct:
- %d
- %s
- %c
- %f
15. format specifiers is used for float type data choose which one is correct:
- %d
- %s
- %c
- %f
16. The %x is a format specifier for choose which one is correct:
- long integer value
- octal value
- hexadecimal value
- double value
17. How many digits are printed to the right of the decimal point in real number choose which one is correct?
- 15
- 3
- 6
- 5
18. is used with format specifier to display output left-justified choose which one is correct:
- %
- +
- –
- *
19. The escape sequence to insert horizontal tab is
- \r
- \f
- \tab
- \t
20. Which of the following format specifier is used for string type data choose which one is correct?
- %s
- %c
- %f
- %string
21. What will be the output of printf(“%.3f”,3.45678); choose which one is correct?
- 345678
- 3.45678
- 3.457
- none of above
22. What will be the output of printf(“%d”, ‘A’); choose which one is correct?
- A
- 65
- ‘A’
- 97
23. Which will be the output of printf(“%c”, ‘A’); choose which one is correct?
- A
- 65
- ‘A’
- 97
24. is the general form of format specifier for real value choose which one is correct:
- m.n%f
- %m.nf
- %fm.n
- None
25. What will be the output of printf(“% .2f”, 5.555); choose which one is correct?
- 5.555
- 5.55
- 5.56
- 5.00
26 characters indicates the beginning of escape sequence choose which one is correct:
- \
- /
- |
- %
27. The escape sequence to insert tab in C is choose which one is correct:
- \n
- \t
- \r
- \f
28. is used to move the cursor at the beginning of current line choose which one is correct:
- \n
- \t
- \r
- \f
29. can be used to begin a new line in C choose which one is correct:
- \n
- \a
- \r
- \b
30. The escape sequence to produce beep from computer speaker is choose which one is correct:
- \t
- \a
- \n
- \b
31. is a correct statement to print “Pakistan” in double quotes choose which one is correct:
- printf(““Pakistan””);
- printf(“\”Pakistan”\”)
- printf(“\”Pakistan\””);
- None
32. The field width will automatically _________ if the specified space is not sufficient to accommodate the value
- Adjusted
- Shrink
- Expand
- All of Above
33. A format specifier always begins with the __ symbol
- %
- \
- /
- %d
34. Escape sequence characters always begins with a ___ character
- %
- \
- /
- %d
35. Which characters cause an escape from the normal interpretation of a string so that the next character is recognized as having a special meaning.
- Format String
- Format Specifier
- Special Characters
- Escape Sequences
36. is a correct statement to input value to a variable ‘x’ of float data type choose which one is correct:
- scanf(“%f”, x);
- scanf(x);
- scanf(“%f’,&x);
- scanf(&x);
37. The ampersand (&) used in “scanf()” function is called choose which one is correct:
- address indicator
- cell address
- binary operator
- address operator
38. The function getche() is defined in choose which one is correct:
- stdio.h
- string.h
- math.h
- conio.h
39. Which escape sequence is used for backspace
- \B
- \b
- /b
- /s
40. scanf() function is used to get data from the
- computer
- processor
- input device
- program
41. is used to get input from user during program execution choose which one is correct:
- scanf()
- gets()
- getche()
- All of these
42. is used to get input from user into any types of variables during the execution of program choose which one is correct:
- scanf()
- gets()
- getche()
- getch()
43. Instead of the variable name the scanf() requires _________ of the variable to store the input value into it
- Name
- Address
- Operator
- Data
44. Which character is used as address of operator
- $
- choose which one is correct?
- #
- &
45. getch() function is used to input ____ character
- One
- Many
- Two
- All of Above
46. getche() function is used to input ____ character
- One
- Many
- Two
- All of Above
47. Which input function will not print the entered character on the screen
- scanf()
- getch()
- getche()
- getline()