Assignment 19 Characterarray Ans
Assignment 19 Characterarray Ans
a. %i
b. %lu
c. %s
d. %us
Answer - c. %s
a. Set of character
b. Bunch of character
c. Group of characters
d. String
Answer - d. String
3. If we miss the address of the operator with a variable in scanf() what is the
behavior of the program when we try to print the value of the variable
a. Runtime Error
b. Unpredictable Value printed on the screen
c. Syntax Error (Address of operator is compulsory)
d. None of the above
a. Yes
b. No
c. Only in Turbo Compiler
d. Only in Modern Compiler like GCC and LLVM
Answer - b. No
5. What is the behavior of the code if we use the address of operator with
character array in scanf() while scanning string as input from the user
a. Syntax Error
b. Runtime Error
c. Unpredictable Value printed on the screen
d. Works the same as works without using the address of the operator
Answer - d. Works same as works without using the address of the operator
a. 64 KB
b. 128 KB
c. 32 KB
d. 16 KB
Answer - a. 64 KB
a. Turbo Compiler
b. GCC Compiler
c. LLVM Compiler
d. CLang Compiler
10. Variables and Arrays are stored in the RAM segment named...
a. IVT
b. BIOS
c. DOS
d. Data Segment
Answer - d. Data Segment
11. '\0' character is also known as...
a. Null character
b. Zero character
c. Backslash character
d. None of the above
a. 0 to 65536
b. 0 to 65535
c. 0 to 2147483648
d. 0 to 2147483647
Answer - b. 0 to 65535
14. Predict the output if provide "Raman" as input to the following character
array.
char str[5];
a. Unpredictable Output
b. Runtime Error
c. Display first 4 characters only
d. display last 4 characters only
Answer - a. Unpredictable Output
15. Does the "%s" format specifier also scans enter pressed by the user during
input?
16. Does the "%s" format specifier also scans space pressed by the user during
input?
a. 0
b. 10
c. 97
d. 45
Answer - a. 0
18. Function better than scanf() which also scans space as the input given by the
user.
a. scan()
b. gets()
c. fgets()
d. get()
Answer - b. gets()
a. stdlib.h
b. stdio.h.
c. conio.h.
d. string.h
Answer - b. stdio.h.
20. Can gets() also takes the input of different data type like int, float, char?