Arrays and Strings: viva questions and MCQs
Computer Programming Lab (C), Unit 6. 100+ Arrays and Strings questions with explanations (Computer Programming Lab (C)). Topics: C Arrays, C Arrays Output. Take a free test now.
Topics
- C Arrays: array string, string item, character, matrix, elements, returns, strlen, stores
- C Arrays Output: printf, prints, strlen, sizeof
Key terms: array string, string item, character, matrix, elements, returns, printf, prints, strlen, sizeof
Sample questions with answers
Memory occupied by int a[10] with 4-byte int is:
Options: A) 4 bytes B) 40 bytes C) 10 bytes D) 14 bytes
Answer: B) 40 bytes. 10 × 4.
In C, "Array name" means:
Options: A) Non-standard function that reverses a string B) Returns the number of characters before the null terminator C) Acts as a pointer to the first element D) Collection of elements of the same type stored in contiguous memory
Answer: C) Acts as a pointer to the first element. Array name: Acts as a pointer to the first element.
In C, "Null character" means:
Options: A) Highest valid index, which is size − 1 B) '\0', marks the end of a string C) Compares two strings, returns 0 if equal D) Converts a lowercase letter to uppercase (ctype.h)
Answer: B) '\0', marks the end of a string. Null character: '\0', marks the end of a string.