
Array Errors Quiz

Quiz
•
Computers
•
University
•
Hard
Juris Ormanis
Used 3+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
csharp

Quiz
•
University
17 questions
Arrays recap

Quiz
•
9th Grade - University
10 questions
pointers and structures

Quiz
•
University
10 questions
reFRESHIEr ICS2602 Quiz

Quiz
•
University
10 questions
Structure Data Review

Quiz
•
University - Professi...
10 questions
DS EXP1

Quiz
•
University
10 questions
C Program Array and strings

Quiz
•
University
10 questions
Arrays in C (II yr 02.07.2020)

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

Interactive video
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University