Array Errors Quiz

Array Errors Quiz

University

12 Qs

quiz-placeholder

Similar activities

Structured/Traditional SDM

Structured/Traditional SDM

University

9 Qs

Process modeling

Process modeling

University

10 Qs

 QUIZ  MS Core Java Quiz-3 2023

QUIZ MS Core Java Quiz-3 2023

University

11 Qs

Pengantar Teknologi Informasi 8

Pengantar Teknologi Informasi 8

University

17 Qs

computer Networks

computer Networks

University

10 Qs

Scratch

Scratch

KG - Professional Development

10 Qs

E-Commerce

E-Commerce

University - Professional Development

16 Qs

DCN5511: Chapter 5 - 7

DCN5511: Chapter 5 - 7

University

15 Qs

Array Errors Quiz

Array Errors Quiz

Assessment

Quiz

Computers

University

Practice Problem

Hard

Created by

Juris Ormanis

Used 3+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

12 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What is the error in the following array initialization? int arr[3] = {1, 2, 3, 4};

The correct initialization should be int arr[4] = {1, 2, 3, 4};

The array size should be 4 instead of 3

The elements should be separated by spaces

The array should be initialized with square braces

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int arr[5];

arr[5] = 10;

arr[-1] = 10;

arr[4] = 10;

arr[4] = {10};

arr = 10;

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Find the error in passing the array to the function: void printArray(int arr);

The error is that the array is not passed by pointer.

The error is that the array is not passed by address.

The error is that the array is not passed by value.

The error is that the array is not passed by reference. The function signature should be void printArray(int *arr) or void printArray(int arr[])

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Identify the error in multidimensional array declaration: int arr[][] = {{1, 2}, {3, 4, 5}};

int arr[][] = {{1, 2}, {3, 4, 5}}; should be corrected to int arr[][] = {{1, 2}, {3, 4, 5}, {6, 7}};

int arr[][] = {{1, 2}, {3, 4, 5}}; should be corrected to int arr[][] = {{1, 2}, {3, 4, 5, 6}};

int arr[][] = {{1, 2}, {3, 4, 5}}; should be corrected to int arr[][] = {{1, 2}, {3, 4, 5}, {6}}

int arr[][] = {{1, 2}, {3, 4, 5}}; should be corrected to int arr[][] = {{1, 2}, {3, 4}};

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Find the error in passing the array to the function: void printArray(int arr[5]);

Add the size to the function signature: void printArray(int arr[], int size);

Pass the array as a pointer to the first element: void printArray(int *arr);

Change the function signature to int printArray(int arr[5]);

Add a reference symbol to the function signature: void printArray(int &arr);

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Identify the error in multidimensional array declaration: int arr[][] = {{1, 2}, {3, 4}, {5}};

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

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

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

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

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the error in the following array initialization? int arr[2] = {1, 2, 3};

The correct initialization should be int arr[2] = {1, 2};

The correct initialization should be int arr[3] = {1, 2, 3};

The array should be initialized with a loop instead of direct assignment

The array size should be larger to accommodate all elements

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?

Discover more resources for Computers