
Understanding 1D Arrays in C

Quiz
•
Information Technology (IT)
•
12th Grade
•
Medium
Ayush Tiwari
Used 1+ times
FREE Resource
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct syntax to declare a 1D array in C?
int[10] arr;
int arr[10];
array int arr[10];
int arr(10);
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you initialize a 1D array with specific values in C?
int arr[5] = new int[5]{1, 2, 3, 4, 5};
int arr(5) = {1, 2, 3, 4, 5};
int arr[] = {1, 2, 3, 4, 5};
int arr = {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
5
0
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you access the third element of an array named 'arr'?
arr[1]
arr[2]
arr[3]
arr.get(2)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What function can be used to determine the length of an array in C?
count(array)
length(array)
array.length()
sizeof(array) / sizeof(array[0])
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you iterate through all elements of a 1D array using a for loop?
for (int i = 0; i < array.length; i += 2) { /* process array[i] */ }
for (int i = 0; i < array.length - 1; i++) { /* process array[i] */ }
for (int i = 1; i <= array.length; i++) { /* process array[i] */ }
for (int i = 0; i < array.length; i++) { /* process array[i] */ }
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will happen if you try to access an array element with an index out of bounds?
The program will run without any issues.
The array will automatically resize to accommodate the index.
The value at the last index will be returned.
An error or exception will occur.
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Көпөлшемді массивтер туралы тест

Quiz
•
12th Grade
25 questions
3 Tri C# 2

Quiz
•
12th Grade
20 questions
Mastering C: Control Structures and More

Quiz
•
12th Grade
25 questions
3 Tri C# 3

Quiz
•
12th Grade
25 questions
The End

Quiz
•
9th - 12th Grade
30 questions
EVALUASI TENGAH SEMESTER GENAP

Quiz
•
10th Grade - University
20 questions
Kelas 8 - Halaman 10 (UH Bab 1)

Quiz
•
8th Grade - University
30 questions
Latihan Soal Informatika Kelas VII

Quiz
•
7th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Information Technology (IT)
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
6 questions
Rule of Law

Quiz
•
6th - 12th Grade
15 questions
ACT Math Practice Test

Quiz
•
9th - 12th Grade
18 questions
Hispanic Heritage Month

Quiz
•
KG - 12th Grade
28 questions
Ser vs estar

Quiz
•
9th - 12th Grade
10 questions
Would you rather...

Quiz
•
KG - University
13 questions
BizInnovator Startup - Experience and Overview

Quiz
•
9th - 12th Grade