Search Header Logo

c++ arrays

Authored by Lakshmi B

Computers

University

Used 1+ times

c++ arrays
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 correctly declares an array?

int array;

array{10};

array array[10];

int array[10];

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a valid way to initialize an array in C?

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

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

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

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

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax to access the third element of an array named 'numbers' in C?

numbers[3];

numbers(3);

numbers{3};

numbers[2];

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to declare a 2D array in C?

int arr[3][3];

arr{3,3};

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

int arr = [3][3];

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you find the length of an array in C?

Using the sizeOf() function;

By counting the number of elements in the array;

There is no direct way to find the length of an array in C;

Using the length() method;

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following array declaration: int arr[5] = {0};. What will be the value of arr[4]?

Garbage value

0

undefined

1

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the index of the first element in an array?

1
-1
0
null

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?