Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C Programming Multiple Choice Questions 3. In C, if an array is declared as doub

ID: 3891433 • Letter: C

Question

C Programming Multiple Choice Questions

3. In C, if an array is declared as double array [261 i, how many numbers can you put in it? a) 50 d) as many as you need b) 25 c) 24 e) none of these 4. If a string is declared as char capital [201:, and the statement strcpy (capital, "Edmonton") is executed, what is the value of capital [81? a) 'E e) none of these b) O c) 'In' d) 'n' 5. If a function is defined as double andromeda (double z, int a) (return (z+a) i, what is the value of andromeda (3, 2.5)? a) 2.5 b) 3 c) 5 d) 5.0 e) 5.5 6. What is the equivalent of char city 'B', 'o', 's', 't', 'o', 'n'0'? a) char citylBoston' b) char cityl "Boston"; c) char city[ ] - "Boston"; d) char city ] Boston; e) none of the above 7. Which of the following functions would be recommended to read an entire sentence as input? b) gets c) scanf a) fgets e) none of these d) input

Explanation / Answer

Solution:

Section 1 ->

1. 7

2. 40

3. None of these because array declared is of size 26 hence we can store up to 26 elements in it.

4. None of these, in array indexing starts from 0 hence the "Edmonton" word at index 0 , E is present at at index 7 n is present and character always ends with a null character that is which is not in the option. capital[8] will print .

5. Option d is correct i.e 5.0

6. b is correct. char city[] = "Botson"

7. b is correct i.e gets

8. None of the above, c could be correct but at last ; is missing. if you can ignore the ; then c is correct.

Do dicsuss with the invigilator

9. c is correct. scanf("%s", dumbledore)

10. c is correct

11. b is correct but again at last after curly brace'}' semicolon is missing .

12. c is correct ans i.e 3

13. c is correct. i.e 9 7 3

14. b is correct i.e double x[4];

15. a is correct.

Note: For any queries do discuss in the comments section below before giving any negative reviews. And if you really liked the solution then don't forget to give a big thumbs up.