
One-Dimensional Array
Authored by SNEHA GEORGE
others
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
1. What is the correct way to declare a one-dimensional array in C?
A) int arr[10];
B) int arr();
C) array int arr[10];
D) int arr[10] = (0);
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
2. What will be the output of the following code? int arr[5] = {10, 20, 30, 40, 50}; printf("%d", arr[2]);
A) 10
B) 20
C) 30
Option 4
D) 50
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
3. What is the index of the last element in an array declared as int marks[6];?
A) 6
B) 5
C) 0
D) 1
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
4. Identify the error in the following code: int a[3]; a[0] = 5; a[1] = 10; a[3] = 15;
A) No error
B) a[3] is out of bounds
C) Missing return type
D) Array not initialized
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
5. What will be the output of this code? int arr[4] = {1, 2}; printf("%d %d %d %d", arr[0], arr[1], arr[2], arr[3]);
A) 1 2 0 0
B) 1 2 garbage garbage
C) 1 2 3 4
D) Compile time error
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
6. Which of the following best describes an array in C?
A) A dynamic collection of variables of different data types
B) A pointer to a string
C) A collection of variables of the same data type
D) A single variable storing a string
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
7. What will be the output? int arr[3] = {2, 4, 6}; arr[1] = arr[1] + arr[2]; printf("%d", arr[1]);
A) 10
B) 6
C) 8
D) 12
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?