
Mastering Arrays in C Programming
Authored by Muhammad Hafizzullah Bin Zakaria
Computers
University
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct syntax to declare an integer array of size 10 in C?
`int array{10};`
`int array[10];`
`array int[10];`
`int [10]array;`
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to initialize an array in C at the time of declaration?
`int arr[5] = {1, 2, 3, 4, 5};`
`int arr[5] := {1, 2, 3, 4, 5};`
`int arr[5] == {1, 2, 3, 4, 5};`
`int arr{5} = (1, 2, 3, 4, 5);`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the index of the first element in a C array?
1
-1
0
Depends on the array size
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which function is used to allocate memory dynamically for an array in C?
`alloc()`
`malloc()`
`new()`
`memalloc()`
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to declare a 2D array of integers with 3 rows and 4 columns in C?
`int arr[4][3];`
`int arr(3)(4);`
`int arr[3][4];`
`int arr[3,4];`
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What value is stored in uninitialized elements when an array is partially initialized in C? For example: `int arr[5] = {1, 2};`
Random garbage values
-1
0
NULL
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following C code snippet: ```c int arr[3][3] = {{1,2,3},{4,5,6},{7,8,9}}; printf("%d", arr[1][2]); ``` What will be the output?
5
6
4
8
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?