Datastructures - Array


Question 1     

Which of the following is a correct way to declare a multidimensional array in c?






Question 2     

What is the output of the below code??

#include <stdio.h>

int main()
{
    int a[2][12]={{1,2,3},{2,12,11,2}};
    printf("%f",a[1][3]);

    return 0;
}





Question 3     

What is the output of below code

int main()
{
    int arr[4] = {1,2,3,4},*p, **q;
    p = arr;
    q = p+3;
    printf("%d %d",*p, *q);
    return 0;
}






Question 4     

What is the output of below C code?

#include<stdio.h>
int main()
{
    int array1[5]={1,2,3};
    printf("%d",(array1[4]-- + ++array1[2]));
    
    return 0;
}





Question 5     

What is the output of below c code?

#include<stdio.h>
int main()
{
    int arr[5] = {1,2,3,4,5} ;
    printf("%d",arr[-1]);
}





Question 6     

What is the output of below code?

#include<stdio.h>
int main()
{
    int array1[10]={1,2,3,4,5,6,7,8,9,10},j,i=4;
    for(j=0;j<i;j++){
        printf("%d ",array1[i++]);
        j++;
    }
}





Question 7     

What is the output of below code?

#include<stdio.h>

int main()
{
    int array[3][3] = {12,19,1,7,6,5,2,8,10};
    printf("%d %d", array[1][1], array[2][0]);
    return 0;
}





Question 8     

In array how the elements can be accessed






Question 9     

What is the value of i and j in end of below code?

#include<stdio.h>
int main()
{
    int i,j,array1[5]={1,2,3};
    i=++array1[4];
    j=++i+array1[--i];
    printf("%d %d",i,j);
    return 0;
}





Question 10     

Fill the blank to print all the elements in given array shown in code

#include <stdio.h>

int main()
{
    int i,j,a[2][12]={{1,2,3,8},{2,12,11,2}};
    for(i=0;i<2;i++){
        for(j=0;j<4;j++){
            ___________________
        }
    }

    return 0;
}





Sign Up Page

Oops!!

To view the solution need to Login



Score : 0 / 0
L
o
a
d
i
n
g
.
.
.