
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
12 questions
C++ Basics (1)

Quiz
•
University
10 questions
C++ Quiz

Quiz
•
University
12 questions
Chapter 2-1: Array Part 1

Quiz
•
University
13 questions
Revision 2 MCA

Quiz
•
University
17 questions
Revision 2 C

Quiz
•
University
10 questions
Introduction to Arrays

Quiz
•
KG - University
10 questions
BCSC0006 - Quiz 1 - Arrays

Quiz
•
University
10 questions
IT Quiz Round 3

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

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

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University