Search Header Logo

CC 102 - Array and Character Sequence

Authored by Daffodelle V. Lucena

Information Technology (IT)

University

Used 5+ times

CC 102 - Array and Character Sequence
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

50 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does an array store?

Values of different types

Elements of the same type in contiguous memory

Only character values

Random data in non-contiguous memory

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The first element of an array in C++ has an index of:

1

-1

0

Depends on the compiler

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following correctly declares an array of 10 integers?

array int[10];

int num[10];

int num = [10];

int[10] num;

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if you access an index beyond the array’s size?

Compiler error

Nothing happens

Runtime error may occur

The compiler automatically resizes the array

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the declaration int foo[5] = {10, 20, 30};, what are the last two elements initialized to?

0

10

Random garbage values

Undefined

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a correct way to initialize an array with five elements?

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

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

Both A and B

None of the above

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What type of error occurs when you exceed the valid range of indices?

Compilation error

Logical/runtime error

Syntax error

Linker error

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?