41.
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;
}

42.
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;
}

44.
What is a sorted array?

45.
When do you use a sparse array?

48.
What does Hamming weight/population count mean in Bit arrays?

Read More Section(Arrays in Data Structures)

Each Section contains maximum 100 MCQs question on Arrays in Data Structures. To get more questions visit other sections.