Arrays In Data Structures - Study Mode

[#136] Suffix array of the string "statistics" is . . . . . . . .
Correct Answer

(A) 2 8 7 4 9 0 5 1 6 3

[#137] The matrix contains m rows and n columns. The matrix is called Sparse Matrix if . . . . . . . .
Correct Answer

(A) Total number of Zero elements > (m*n)/2

[#138] Both Dynamic array and Dynamically memory allocated array are same.
Correct Answer

(B) False

[#139] Consider the following piece of code in C++. What does the following code implement? #include <iostream>
using namespace std

int main()
{
int *arr_vla

int size

cout<<"Enter the size of variable length array: "

cin>>size

arr_vla = new int [size]

for (int i = 0

i < size

i++)
{
cout<<"Enter the integers to be inserted in the variable length array: "

cin>>arr_vla[i]

}
for(int i = 0

i < size

i++)
{
cout<<arr_vla[i]<<" "

}
cout<<endl

return 0

}
Correct Answer

(A) Variable-length array

[#140] What will be the time complexity of the following code? #include <iostream>
using namespace std

int main()
{
int arr[] = {1,2,3,4,5,6}

int n = sizeof(arr)/sizeof(arr[0])

int d=4

int temp[10]

for(int i=0

i<d

i++)
temp[i]=arr[i]

int j=0

for(int i=d

i<n

i++,j++)
arr[j]=arr[i]

int k=0

for(int i=n-d

i<n

i++,k++)
arr[i]=temp[k]

for(int i=0

i<n

i++)
cout<<arr[i]<<" "

return 0

}
Correct Answer

(B) O(n)