Arrays C++
Quiz
•
Computers
•
University
•
Practice Problem
•
Easy
Long Trần
Used 1+ times
FREE Resource
Enhance your content in a minute
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
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?
Similar Resources on Wayground
10 questions
Python with DataScience
Quiz
•
7th Grade - University
15 questions
Robotics Prelim
Quiz
•
University
10 questions
UTILITY PROGRAM
Quiz
•
University
10 questions
Data Warehouse - Foundations
Quiz
•
University
13 questions
Digital Technology Office 365 - 29May2020
Quiz
•
University - Professi...
7 questions
Data mining-Clustering-1
Quiz
•
University
15 questions
GIS Unit III
Quiz
•
University
15 questions
Computer and Other Human Inventions
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
