Question 1

Time: 00:00:00
An array is also known as ___________

Subscripted variable

Subscripted variable

Collective array

Collective array

Ordinary variable

Ordinary variable

Similar Quantities variable

Similar Quantities variable

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

Please login to submit your explanation

PrepInsta User

array contain simlar continous value

Question 2

Time: 00:00:00
Till the array elements are not given any specific value, they are supposed to contain all ____________

Zero

Zero

Garbage value

Garbage value

One

One

Combination of zero and one.

Combination of zero and one.

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

Please login to submit your explanation

Question 3

Time: 00:00:00
If array is initialized where it is declared, then mentioning __________ of array is optional.

Data type

Data type

Dimension

Dimension

name

name

Data type and Dimension

Data type and Dimension

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

Please login to submit your explanation

Question 4

Time: 00:00:00
What happen if we assign a value to an array element whose subscript exceeds the size of array.

The program will give error

The program will give error

No output

No output

program will crash

program will crash

none of these

none of these

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

Please login to submit your explanation

Question 5

Time: 00:00:00
What will be output of the following program int main() {    int b[4]={5,1,3,2,4};    int k,l,m;     k=++b[1];     l=b[1]++;    m=b[k++];  printf(“%d, %d, %d”,k,l,m); return 0; }

2, 3, 20

2, 3, 20

3, 2, 32

3, 2, 32

1, 2, 5

1, 2, 5

2, 3, 15

2, 3, 15

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

Please login to submit your explanation

PrepInsta User

All are wrong. 2,2,32 is correct answer

PrepInsta User

3,2,32 is correct ans.

PrepInsta User

ans is here

PrepInsta User

Here, ++b[1] means that firstly b[1] will be incremented so, b[1]=2 then assigned to k i.e. k=2. b[1]++ means firstly b[1] will be assigned to variable l i.e. l=2, Then value stored in b[1] will be incremented i.e. b[1]=3. b[k++] means first b[k] will be assigned to m i.e. m=32, then value of k will be incremented i.e. k=3.

PrepInsta User

3,2,32 is not mention

Question 6

Time: 00:00:00
What will be output of the following program where c=65474 and int=2 bytes. int main() {  int c[3][4]={2,3,1,6,4,1,6,2,2,7,1,10};        printf(“%u, %u\n”, c+1, &c+1);        return 0; }

65482, 65498

65482, 65498

65476, 65476

65476, 65476

65476, 65498

65476, 65498

No output

No output

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

Please login to submit your explanation

PrepInsta User

Here c[3][4]= { {2,3,1,6}; {4,1,6,2}; {2,7,1,10} }; c+1 means c is base address i.e. address of 1st one Dimensional array and on incrementing it by 1 means it points to 2nd one 2 Dimensional array. So, c+1=65474 + ( 4 * 2)= 65482 But, when we are writing &c, that means address of this whole array i.e. address of next new array. So, &c+1=65474 + (12 * 2)=65498

PrepInsta User

wrong output

PrepInsta User

please it\'s explanation

PrepInsta User

Garbage value and 1234

PrepInsta User

1128571040, 1128571072

Question 7

Time: 00:00:00
What will be output of the following program int main() {    int a[5],i=0;        while(i<5)         a[i]=++i;    for(i=0;i<5;i++)     printf(“%d,”,a[i]); }

garbage value,1,2,3,4

garbage value,1,2,3,4

1,2,3,4,5

1,2,3,4,5

Error

Error

Program crash

Program crash

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

Please login to submit your explanation

PrepInsta User

Ans will be error

PrepInsta User

wrong output

PrepInsta User

wrong output

PrepInsta User

195744,1,2,3,4, ...Program finished with exit code 0 Press ENTER to exit console. i got this

PrepInsta User

4195648,1,2,3,4, garbage value and 1234

Question 8

Time: 00:00:00
What will be output of the following program int main() {    float a[]={12.4, 2.3, 4.5, 6.7};    printf(“%d, %d”, sizeof(a), sizeof(a[0])); return 0; }

16 bytes, 4 bytes

16 bytes, 4 bytes

4 bytes, 4 bytes

4 bytes, 4 bytes

8 bytes, 4 bytes

8 bytes, 4 bytes

None of these

None of these

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

Please login to submit your explanation

PrepInsta User

please explain anyone this..

Question 9

Time: 00:00:00
Which one of this is equivalent to

int fun(int arr[])

int fun(arr)

int fun(arr)

int fun(int arr[2])

int fun(int arr[2])

int fun(int s[])

int fun(int s[])

None of these

None of these

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

Please login to submit your explanation

Question 10

Time: 00:00:00
In 2 Dimensional Array, it is necessary to mention  _______ dimension.

second

second

first

first

both

both

none of these

none of these

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

Please login to submit your explanation

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

Buy TCS Prog. Logic (C MCQ) Paid Materials

Join TCS Online Classes

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Get over 200+ Courses under One Subscription

mute

Don’t settle Learn from the Best with PrepInsta Prime Subscription

Learn from Top 1%

One Subscription, For Everything

The new cool way of learning and upskilling -

Limitless Learning

One Subscription access everything

Job Assistance

Get Access to PrepInsta Prime

Top Faculty

from FAANG/IITs/TOP MNC's

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Comments

2 comments on “TCS Array Questions Quiz-1”