TCS NQT Array Quiz- 1

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

D

Start

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

A

Start

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

Start

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

Answer is A....The program give excess error

Start

Question 5

Time: 00:00:00

Which one of these is equivalent to?

int fun(int arr[])

int fun(arr)

int fun(arr)

int fun(int s[])

int fun(int s[])

None of these

None of these

int fun(int arr[5])

int fun(int arr[5])

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

Please login to submit your explanation

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.

Start

Question 6

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

Start

Question 7

Time: 00:00:00
An array can be passed to a function by __________

Both a and b

Both a and b

Call by reference by passing base address to a function

Call by reference by passing base address to a function

Call by reference

Call by reference

call by value

call by value

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

Please login to submit your explanation

Explaination: firstly right side of any expression is evaluated, then the left side is evaluated. So, here ++i will be evaluated at first, then a[i]. Hence, when i=0, a[1]=1, then i=1, a[2]=2,…a[4]=4 and a[0]=garbage value

A

Start

Question 8

Time: 00:00:00
What will be output of the following program
#include<stdio.h>
int
main ()
{
int arr[4] = { 3, 4, 5, 6 };
int k[4];
k = arr;
printf ("%d \ n", k[1]);
return 0;
}

Compile Time Error

Compile Time Error

4

4

No output

No output

Program crashes

Program crashes

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 will be output of the following program?

int main()
{
 int b[4]={5,1,32,4};
   int k,l,m;
 k=++b[1];
 l=b[1]++;
 m=b[k++];
 printf(“%d, %d, %d”,k,l,m);
  return 0;
}

2, 2, 4

2, 2, 4

2, 3, 32

2, 3, 32

3, 2, 32

3, 2, 32

3, 2, 4

3, 2, 4

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

Please login to submit your explanation

Start

Question 10

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]={1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0};
  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

Start

Question 11

Time: 00:00:00
What will be output of the following program ?


#include <stdio.h>
int main ()
{
int a[5], i = 0;
while (i < 5)
{
a[i] = ++i;
}
for (i = 0; i < 5; i++)
{
printf ("%d,"", a[i]);
}
return 0;
}

Error

Error

Program crash

Program crash

1,2,3,4,5

1,2,3,4,5

garbage value,1,2,3,4

garbage value,1,2,3,4

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

Please login to submit your explanation

Start

Question 12

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

Start

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

Buy TCS NQT Paid Materials

Paid Materials TCS NQT

Join TCS NQT 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%

Completed

0/12

Accuracy

0%

Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

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.

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.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects

Comments