
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
Grade 12B Midterm Exam: ERDs, EHR, and SQL

Quiz
•
12th Grade
20 questions
12A and C version 1 Final Semester 1 Exam

Quiz
•
12th Grade
23 questions
Ôn Tập Buổi 6 IOT

Quiz
•
9th - 12th Grade
20 questions
Quiz Komputasional-Struktur Data kelas 9

Quiz
•
9th Grade - University
20 questions
Pre Test

Quiz
•
12th Grade
20 questions
Тест по основам Python(intro1)

Quiz
•
9th - 12th Grade
26 questions
AP COMP SCI A: CodeHS Units 6/7/8 VOCAB

Quiz
•
12th Grade
30 questions
NumPy Basics Quiz

Quiz
•
12th Grade - University
Popular Resources on Wayground
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
Discover more resources for Information Technology (IT)
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
62 questions
Spanish Speaking Countries, Capitals, and Locations

Quiz
•
9th - 12th Grade
20 questions
First Day of School

Quiz
•
6th - 12th Grade
6 questions
Maier - AMDM - Unit 1 - Quiz 1 - Estimation

Quiz
•
12th Grade
21 questions
Arithmetic Sequences

Quiz
•
9th - 12th Grade
21 questions
9th Grade English Diagnostic Quiz

Quiz
•
9th - 12th Grade
7 questions
Characteristics of Life

Interactive video
•
11th Grade - University