ExamVeda
Login
Home
1
What is the highest index for an array with 10 elements in C?
Discuss
Answer & Solution
Answer: Option B
Solution:
An array in C is indexed starting from 0.

If an array has 10 elements, the first element will have an index of 0.

The last element, therefore, will have an index of 9.

Hence, the highest index for an array with 10 elements is 9.
2
Which keyword is used to declare a character array in C?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
3
What is the size of an integer array declared as int arr[5] in bytes?
Discuss
Answer & Solution
Answer: Option B
Solution:
The size of an integer array declared as int arr[5] in bytes depends on the size of an integer in the system. Typically, the size of an int is 4 bytes.

Calculation:
The array arr has 5 elements.
Each int is 4 bytes.
Total size = 5 * 4 = 20 bytes
Therefore, the size of int arr[5] is 20 bytes.
4
Which function is used to compare two strings in C?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
5
How do you access the first element of an array arr in C?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
6
Which type of loop is commonly used to iterate through an array in C?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
7
What is the maximum number of elements that can be stored in an array in C?
Discuss
Answer & Solution
Answer: Option A
Solution:
The maximum number of elements that can be stored in an array in C depends on the available memory of the system in which the program is running. An array in C is a fixed-size data structure, which means that you need to specify the size (number of elements) of the array when you declare it.

Here are a few key points:

The size of an array should be a positive integer.
The maximum value for the size of an array is limited by the amount of memory available in the system.
The actual maximum size may vary from system to system.
Attempting to allocate an array that is too large for the available memory can lead to program crashes or errors.

So, in C, you can declare an array with a size that depends on the specific memory constraints of the computer where the program is executed. This is why the correct answer is Option A: Depends on memory. The other options specify fixed limits, which is not accurate for C arrays.

Remember that it's essential to manage memory efficiently to avoid issues like memory exhaustion or segmentation faults when working with arrays in C.
8
Which function is used to find the length of a string in C?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
9
What is the term for accessing elements of an array using an index in C?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
10
What character is used to terminate a C string?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board