Arrays C++- CS 172 Exercise #1

Arrays C++- CS 172 Exercise #1

Assessment

Flashcard

Science, Computers

8th - 12th Grade

Hard

Created by

Quizizz Content

FREE Resource

Student preview

quiz-placeholder

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?