0% found this document useful (0 votes)
8 views

Assignment 19 Characterarray Ans

The document contains 20 multiple choice questions about C programming concepts like string handling, scanf(), gets(), character arrays and more. The questions cover topics like format specifiers for strings, need for address of operator in scanf(), behavior of character array with long input, difference between scanf() and gets() and more.

Uploaded by

Yash rai
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Assignment 19 Characterarray Ans

The document contains 20 multiple choice questions about C programming concepts like string handling, scanf(), gets(), character arrays and more. The questions cover topics like format specifiers for strings, need for address of operator in scanf(), behavior of character array with long input, difference between scanf() and gets() and more.

Uploaded by

Yash rai
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Assignment of objective questions

1. Format specifier used for taking multiple characters is...

a. %i
b. %lu
c. %s
d. %us

Answer - c. %s

2. Set of multiple characters is known as...

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

Answer - b. Unpredictable Value printed on the screen


4. Is the address-of operator is compulsory in scanf() while scanning string as an
input from the user?

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

6. An array name always represent its base address.

a. True only for Turbo Compiler


b. True only for GCC Compiler
c. True only for LLVM Compiler
d. True for every Compiler(provided for C/C++ language)

Answer - d. True for every Compiler(provided for C/C++ language)


7. Predict the output
int arr[5] = {10, 20, 30, 40, 50};
printf("%d", arr);

a. Prints the address of arr


b. Prints the value of arr
c. Prints the address of arr[0]
d. Prints the value of arr[0]

Answer - a. Prints the address of arr

8. Amount of memory of segment in Turbo compiler is...

a. 64 KB
b. 128 KB
c. 32 KB
d. 16 KB

Answer - a. 64 KB

9. bios. h header file available in which compiler?

a. Turbo Compiler
b. GCC Compiler
c. LLVM Compiler
d. CLang Compiler

Answer - a. Turbo 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

Answer - a. Null character

12. In the Turbo compiler the address range is of...

a. 0 to 65536
b. 0 to 65535
c. 0 to 2147483648
d. 0 to 2147483647

Answer - b. 0 to 65535

13. The character array in size should be of...

a. length of the known inputted string


b. length - 1 of the known inputted string
c. length + 1 of the known inputted string
d. None of the above

Answer - c. length + 1 of the known inputted string

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?

a. Yes, in Turbo Compiler the only


b. Yes, in GCC Compiler the only
c. No, in Turbo Compiler only
d. Doesn't (scan behavior of its functionality)

Answer - d. Doesn't (scan behavior of its functionality)

16. Does the "%s" format specifier also scans space pressed by the user during
input?

a. Yes, in Turbo Compiler the only


b. Yes, in GCC Compiler the only
c. No, in Turbo Compiler only
d. Doesn't scan (behavior of its functionality)

Answer - d. Doesn't scan (behavior of its functionality)

17. ASCII of Null character is.

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()

19. gets() available in the header file...

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?

a. Yes, scans but as string


b. No, Syntax Error
c. No, Runtime Error
d. Yes, but will display unpredictable value

Answer - a. Yes, scans but as a string

You might also like