Computer Programming (3310701) MCQs

MCQs of Introduction of Array (One Dimensional)

Showing 1 to 10 out of 34 Questions
1.

What is right way to initialize array?

એરે ને ઇનિશિયલાઈઝ કરવા માટે ની સાચી રીત શું છે?

(a)

int num[6] = {2,4,12,5,45,5};

(b)

int n{} = {2,4,12,5,45,5};

(c)

int n{6} = {2,4,12};

(d)

int n(6) = {2,4,12,5,45,5};

Answer:

Option (a)

2.

An array elements are always stored in ________ memory locations.

એરે એલિમેન્ટ્સ હંમેશાં ________ મેમરી લોકેશન્સ માં સ્ટોર થાય છે.

(a)

Sequential

સિક્વન્સીઅલ

(b)

Random

રેન્ડમ

(c)

Sequential and Random

સિક્વન્સીઅલ અને રેન્ડમ

Answer:

Option (a)

3.

What is the output of this C code?

void main()
{
       int arr[10] = {1,2,3,4,5};
       printf("%d", arr[5]);
}

આપેલા C કોડનું આઉટપુટ શું હશે?

void main()
{
       int arr[10] = {1,2,3,4,5};
       printf("%d", arr[5]);
}

(a)

Garbage value

(b)

5

(c)

6

(d)

0

Answer:

Option (d)

4.

Which of the following correctly accesses the seventh element stored in arr, an array with 100 elements?

100 એલિમેન્ટ્સ વાળા એરે માંથી સ્ટોર થયેલા સાતમા એલિમેન્ટને યોગ્ય રીતે એક્સેસ નીચેના માંથી કઈ રીતે કરી શકાય?

(a)

arr[6]

(b)

arr[7]

(c)

arr{6}

(d)

arr{7}

Answer:

Option (a)

5.

An array Index starts with?

એરે ઇન્ડેક્સ ક્યાંથી શરૂ થાય છે?

(a)

-1

(b)

0

(c)

1

(d)

2

Answer:

Option (b)

6.

What is the output of this C code?

void main() 

       int a[]; 
       a[4] = {1,2,3,4}; 
       printf("%d", a[0]); 
}

આપેલા C કોડનું આઉટપુટ શું હશે?

void main() 

       int a[]; 
       a[4] = {1,2,3,4}; 
       printf("%d", a[0]); 
}

(a)

1

(b)

2

(c)

4

(d)

Compile time error

Answer:

Option (d)

7.

What is the output of this C code?

void main() 

       int a[] = {1,2,3,4}; 
       int b[4] = {5,6,7,8}; 
       printf("%d,%d", a[0], b[0]); 
}

આપેલા C કોડનું આઉટપુટ શું હશે?

void main() 

       int a[] = {1,2,3,4}; 
       int b[4] = {5,6,7,8}; 
       printf("%d,%d", a[0], b[0]); 
}

(a)

1,5

(b)

2,6

(c)

0,0

(d)

Compile time error

Answer:

Option (a)

8.

What is the output of this C code?

void main() 

       float marks[3] = {90.5, 92.5, 96.5}; 
       int a=0; 

       while(a<3) 
       { 
               printf("%.2f,", marks[a]); 
               a++; 
       } 
}

આપેલા C કોડનું આઉટપુટ શું હશે?

void main() 

       float marks[3] = {90.5, 92.5, 96.5}; 
       int a=0; 

       while(a<3) 
       { 
               printf("%.2f,", marks[a]); 
               a++; 
       } 
}

(a)

90.5 92.5 96.5

(b)

90.50 92.50 96.50

(c)

0.00 0.00 0.00

(d)

Compile time error

Answer:

Option (b)

9.

What is the output of this C code?

void main() 

       int a[3] = {10,12,14}; 
       int i=0; 

       while(i<3) 
       { 
               printf("%d ", a[i]); 
               i++; 
       } 
}

આપેલા C કોડનું આઉટપુટ શું હશે?

void main() 

       int a[3] = {10,12,14}; 
       int i=0; 

       while(i<3) 
       { 
               printf("%d ", a[i]); 
               i++; 
       } 
}

(a)

14 12 10

(b)

10 10 10

(c)

10 12 14

(d)

12 12 12

Answer:

Option (c)

10.

What is the maximum number of dimensions an array in C may have?

C માં એરે ની મેક્સિમમ ડાઈમેન્સન કેટલી હોય શકે?

(a)

Two

(b)

eight

(c)

sixteen

(d)

No Limits. Depends on compiler.

Answer:

Option (d)

Showing 1 to 10 out of 34 Questions