
C++ Arrays Quiz

Quiz
•
Information Technology (IT)
•
University
•
Medium
cjdsjv vjds acssacascas
Used 1+ times
FREE Resource
62 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 5 pts
What is an array in C++?
A collection of elements of the same type stored in contiguous memory locations
A single variable that holds multiple values of different types
A function that performs calculations
A keyword for declaring variables
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the index of the first element in an array?
0
1
-1
Depends on the array size
3.
MULTIPLE CHOICE QUESTION
1 min • 5 pts
How do you declare an integer array of size 5 in C++?
int array[5];
array
int array = {5};
int array[];
4.
MULTIPLE CHOICE QUESTION
1 min • 5 pts
What will happen if you access an array index that is out of bounds?
Undefined behavior
The program will crash
It will return 0 by default
Compiler error
5.
MULTIPLE CHOICE QUESTION
1 min • 5 pts
Which of the following is NOT a valid array declaration?
double data[] = new double[5];
int arr[5];
float numbers[10];
char str[20];
6.
MULTIPLE CHOICE QUESTION
1 min • 5 pts
Which statement correctly initializes an array?
int arr[3] = {1, 2, 3};
int arr = {1, 2, 3};
arr[3] = {1, 2, 3};
int arr[3]; arr = {1, 2, 3};
7.
MULTIPLE CHOICE QUESTION
1 min • 5 pts
What will be the output of the following code? int arr[] = {10, 20, 30, 40}; cout << arr[2];
30
10
20
40
Create a free account and access millions of resources
Similar Resources on Wayground
66 questions
07.Mock_SoftwareProgrammingMethods_ProgrammingTechniques_v1.0

Quiz
•
University
60 questions
Data Structure UTS

Quiz
•
University
60 questions
Python 1

Quiz
•
University
60 questions
IMC413 Test 2 20244

Quiz
•
University
62 questions
C++ Arrays Quiz

Quiz
•
University
61 questions
Test Quiz

Quiz
•
University
64 questions
Algorithm and Programming Concepts Quiz

Quiz
•
University
62 questions
Python final questions part 1

Quiz
•
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