Search Header Logo

Quiz PF Topic 4 Array

Authored by Athirah Musa

Computers

12th Grade

Used 2+ times

Quiz PF Topic 4 Array
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to declare an array of integers in C++?

int array[10];

array int[10];

int[10] array;

int array(10);

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you initialize an array with the values 1, 2, 3, 4, 5 in C++?

int arr[] = {1, 2, 3, 4, 5};

int arr[5] = {1, 2, 3, 4, 5};

Both int arr[] = {1, 2, 3, 4, 5}; & int arr[5] = {1, 2, 3, 4, 5};

int arr(5) = {1, 2, 3, 4, 5};

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the index of the first element in a C++ array?

0

1

-1

Depends on the array size

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements correctly accesses the third element of an array named arr?

arr[2]

arr(3)

arr{}

arr[3]

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code?

int arr[5] = {1, 2, 3, 4, 5};

cout << arr[1] + arr[3];

5

6

7

8

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code output?

int arr[3] = {1, 2, 3};

cout << arr[1];

1

2

3

0

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you declare an integer array of size 5 in C++?

int array[5];

array int[5];

int[5] array;

int array(5);

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?