Please login

Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

HackWithInfy Array Manipulation Quiz-2

Question 1

Time: 00:00:00
Which among the following is true about Array?

1.is a collection of similar type of element

2.uses continues memory locations to store every data item of array

3.Once the size of the Array is defined, then the size of the array can not be modified

4.all the above

i and ii

i and ii

ii and iii

ii and iii

 i and iii

 i and iii

iv

iv

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
How many types array there :-

1-D array

1-D array

2-D array

2-D array

Multidimensional array

Multidimensional array

All the above

All the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
How to represent array elements in the code :-

int marks[5];     arr[0]=9;     arr[1]=1;     arr[2]=4;     arr[3]=18;     arr[4]=15;

int marks[5];     arr[0]=9;     arr[1]=1;     arr[2]=4;     arr[3]=18;     arr[4]=15;

 int marks[6]={19,2,10,8,61};

 int marks[6]={19,2,10,8,61};

 int arr[3][4]={1,2,3,4,2,3,4,5,3,4,5,6};

 int arr[3][4]={1,2,3,4,2,3,4,5,3,4,5,6};

All the above.

All the above.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
#include<stdio.h>

int main()

{

   int arr[4];       

   int i,a;

   for(i=0;i<4;i++)   

   {

       scanf("%d",&arr[i]);

   }

   for(i=0;i<4;i++)    

   {

       printf("%d",arr[i]);

   }

   return 0;

}

1 2 3 4

1 2 3 4

4 3 2 1

4 3 2 1

1 22  33  44

1 22  33  44

1 22  333  4444

1 22  333  4444

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
Difference between 1-D array and 2-D or multidimensional array :-

in a 2-D array are stored in a matrix format rather than a linear manner

in a 2-D array are stored in a matrix format rather than a linear manner

the elements are stored in rows and columns like a matrix.

the elements are stored in rows and columns like a matrix.

Both use linear manner to store elements in the array

Both use linear manner to store elements in the array

a and b

a and b

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
How do declare and instantiate elements in an array in Java?

 int arr[] = new int[5];

 int arr[] = new int[5];

int arr[];

int arr[];

int arr() = new int(3);

int arr() = new int(3);

int arr[] = new int(9);

int arr[] = new int(9);

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
What is the output of the following piece of code?

11 51 40

11 51 40

11 40 30  

11 40 30  

11 2  30  40  51

11 2  30  40  51

11 2  30  40

11 2  30  40

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
public class array

{

        public static void main(String args[])

        {

             int []arr = {11,12,13,14,15};

             System.out.println(arr[5]);

         }

}

15

15

Compile-time

Compile-time

InvalidInputException

InvalidInputException

ArrayIndexOutOfBoundsException

ArrayIndexOutOfBoundsException

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
What are the disadvantages of arrays?

Queue or stack cannot be implemented in the array

Queue or stack cannot be implemented in the array

There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

Easier to store elements of same data type

Easier to store elements of same data type

Index value of an array can be negative

Index value of an array can be negative

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
 If int has 4- bytes then what is the size of int arr[5]?

20

20

9

9

19

19

25

25

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]