Arrays C++

Quiz
•
Computers
•
University
•
Easy
Long Trần
Used 1+ times
FREE Resource
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is an array in C++?
A collection of variables of different data types
A collection of elements of the same data type stored in contiguous memory locations
A collection of pointers
A function that stores multiple values
2.
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
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a valid way to declare an array in C++?
int arr[];
int arr[5];
arr int[5];
array[5] int;
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you access the third element of an array `arr` in C++?
arr[2]
arr[3]
arr(2)
arr.get(2)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements is true about array size in C++?
The size of an array can be changed after its declaration
The size of an array is fixed once declared
The size of an array is automatically doubled when full
The size of an array can be dynamically changed at runtime
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you initialize an array of size 5 with values 1, 2, 3, 4, and 5 in C++?
int arr[5] = {1, 2, 3, 4, 5};
int arr[5] = (1, 2, 3, 4, 5);
int arr = {1, 2, 3, 4, 5};
int arr[5] = [1, 2, 3, 4, 5];
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens if you try to access an array element with an index outside its bounds?
The program crashes
The program will return a random value
The program will return the last element in the array
The behavior is undefined
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Arrays Review

Quiz
•
11th Grade - University
10 questions
ARRAY C++

Quiz
•
University
15 questions
DATA STRUCTURES QUIZ

Quiz
•
University
12 questions
DS_NumPy_TEST1

Quiz
•
University
15 questions
BASIC C PROGRAMMING QUIZ

Quiz
•
University
10 questions
Expression in C Programming

Quiz
•
University
15 questions
Wipro PRP - 5th June

Quiz
•
University
15 questions
Qûîz

Quiz
•
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 Computers
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

Interactive video
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University