![]() |
VOOZH | about |
Question 1
What is the size of the array char arr[] = "geeksforgeeks";?
12
13
15
14
Question 2
What is the index of the last element in an array int arr[20];?
20
19
21
18
Question 3
How do you pass an array to a function in C++?
By copying
By value
By pointer
By name
Question 4
What will be the output of the following C++ code?
1 2 3
1 2 1
1 2 0
Compilation error
Question 5
What will be the output of the following code?
1 2 3
6 7 8
1 7 3
Compilation error
Question 6
Which of the following are true about multidimensional arrays in C++?
They are arrays of arrays
The syntax to declare a 2D array is type arrayName[rows][columns];
They can have two or more dimensions
All of the above
Question 7
What will be the output of the following code?
1
2
5
6
Question 8
Which of the following is the correct syntax to dynamically allocate a 1D array of 20 integers in C++ without initialization?
int* arr = new int[20];
int* arr = new int();
int* arr = new int[20]();
int* arr = new int* [20];
Question 9
Which of the following statements about arrays is/are incorrect?
Arrays are always passed by value to functions
The name of the array is a pointer to its first element
Arrays can be initialized at the time of their declaration
None of the above
Question 10
What will be the output of the following code?
1
3
4
2
There are 23 questions to complete.