Arrays C++- CS 172 Exercise #1

Flashcard
•
Science, Computers
•
8th - 12th Grade
•
Hard
Quizizz Content
FREE Resource
Student preview

15 questions
Show all answers
1.
FLASHCARD QUESTION
Front
What is an array in C++?
Back
An array is a collection of elements of the same data type stored in contiguous memory locations, allowing for efficient access and manipulation.
2.
FLASHCARD QUESTION
Front
What is the syntax to declare an array of integers in C++?
Back
int arrayName[size]; where 'size' is the number of elements in the array.
3.
FLASHCARD QUESTION
Front
What is the first legal subscript for an array in C++?
Back
0, as C++ uses zero-based indexing.
4.
FLASHCARD QUESTION
Front
What is the last legal subscript for an array declared as int values[5]?
Back
4, because the valid indices are 0 to 4.
5.
FLASHCARD QUESTION
Front
How do you access the third element of an array named 'numbers'?
Back
You can access it using numbers[2], since indexing starts at 0.
6.
FLASHCARD QUESTION
Front
What will the following code display? int numbers[5] = {99, 87, 66, 55, 101}; cout << numbers[1];
Back
87, as it accesses the second element of the array.
7.
FLASHCARD QUESTION
Front
What is the difference between an array and a variable in C++?
Back
An array can hold multiple values of the same type, while a variable holds a single value.
Create a free account and access millions of resources
Similar Resources on Wayground
13 questions
java variables 1

Flashcard
•
9th - 12th Grade
15 questions
Multiplication with repeated addition and arrays

Flashcard
•
9th - 12th Grade
8 questions
Python Casting & Data Types

Flashcard
•
9th - 12th Grade
20 questions
Unit 6 Test Review - Arrays

Flashcard
•
9th - 12th Grade
10 questions
Arrays

Flashcard
•
10th - 12th Grade
8 questions
2D array flashcard

Flashcard
•
9th - 12th Grade
15 questions
AP Computer Science A Review 1

Flashcard
•
10th - 12th Grade
11 questions
for and while loops level 2

Flashcard
•
9th - 12th Grade
Popular Resources on Wayground
15 questions
Hersheys' Travels Quiz (AM)

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
30 questions
Lufkin Road Middle School Student Handbook & Policies Assessment

Quiz
•
7th Grade
20 questions
Multiplication Facts

Quiz
•
3rd Grade
17 questions
MIXED Factoring Review

Quiz
•
KG - University
10 questions
Laws of Exponents

Quiz
•
9th Grade
10 questions
Characterization

Quiz
•
3rd - 7th Grade
10 questions
Multiply Fractions

Quiz
•
6th Grade