Array Data Structure Quiz for Beginners

Question 1

The size of the array should always be _____

• Positive

• Negative

• whole Number

• Real Number

Question 2

With the help of which operator array elements can be accessed?

• Parenthesis ( )

• Braces { }

• Subscript Operator [ ]

• None of these

Question 3

Which of the following statement is correct about array?

• The size of the array is fixed.

• The size of the array is dynamic.

• Random access is not possible in an array.

• None of these

Question 4

Which of the following syntax correctly declares an Array in C/C++?

• int geeks;

• array geeks[20];

• geeks{20};

• int geeks[20];

Question 5

What is the output of the following code:

C++ ```#include <bits/stdc++.h> using namespace std; int main() { int arr[5] = {1, 2, 3}; //Printing the value cout<< arr[4]<<endl; return 0; } ```
• 3

• Compile error

• Run time error

• 0

Question 6

Which of the following statements correctly declares a two-dimensional integer array in C/C++?

• arr[5 *4]

• int arr[5][4];

• arr[2][2]

• All of these

Question 7

In an array int arr[3]={1,2,3}, what will happen if we try to access arr[4] in C/C++?

• Run TIme error

• 3

• 0

• Garbage Value

Question 8

What is the output of the following program?

C++ ```#include <iostream> using namespace std; int main() { int arr[5] = { 2, 6, 8, 13, 19 }; // Modifing the data for (int i = 0; i < 5; i += 2) arr[i]++; for (int i = 0; i < 5; i++) cout << arr[i] << endl; return 0; } ```
• 2, 6, 8, 13, 19

• 3, 6, 9, 13, 20

• 3, 7, 9, 14, 20

• None of these

Question 9

What is the time complexity to insert a single element in the array?

• O(1)

• O(n)

• O(log n)

• none

Question 10

What is the famous mathematical example of 2-d array?

• cube

• Dice

• Matrix

• none

There are 30 questions to complete.

Last Updated :
Take a part in the ongoing discussion