TCS NQT Input/Output Quiz- 4

Question 1

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

int main()
{
   short int diff=1;
   switch(++diff-diff++){
       case 1:
       printf("one over subtraction");
       break;
       case 2:
       printf("two over subtraction");
       break;
       default:
       printf("None");
       break;
   }
   return 0;
}

two over subtraction

two over subtraction

one over subtraction

one over subtraction

None

None

No output

No output

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

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Write the output of the following code in box?

#include <iostream>

int main(void)
{
int stones=5,pebbles=1;
stones-=pebbles+=stones;
printf("%d",stones);
return 0;
}

5

5

1

1

-1

-1

7

7

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

Please login to submit your explanation

Start

Question 3

Time: 00:00:00

What will be the output of the following code



#include <iostream>
int main()
{
int x=5;
int y=5;
if(!(x|y))
printf("x=y");
else
printf("x!=y");
return 0;
}

Run time error

Run time error

Compile time error

Compile time error

x!=y

x!=y

x=y

x=y

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 is the output of below code?

#include <stdio.h>
int main()
{
int cat;
for(cat=5;cat>=1;cat--);
printf("%d",cat);
   return 0;
}

0  

0  

5  

5  

54321  

54321  

543210

543210

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

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
What is the output of below code?
#include <iostream>
using namespace std;
int main()
{
int i;
for(i=5;i<=10;i++){
printf("%d",i);
}
return 0;
}

56789

56789

567890

567890

5678910

5678910

Error

Error

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

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
Wha is the output of below code?
#include <iostream>
using namespace std;
int main()
{
do{
do{
printf("A");
break;
}while(1);
printf("B");
}while(0);

return 0;
}

Print a infinitely

Print a infinitely

Print AB

Print AB

Print B infinitely

Print B infinitely

Print A infinitely

Print A infinitely

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 below code?
#include <iostream>
using namespace std;
int main()
{
int number=0141;
printf("%c",number);
return 0;
}

  Compilation error  

  Compilation error  

1100001  

1100001  

a  

a  

97

97

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

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
What is the output of below code?

#include <iostream>
using namespace std;
int main()
{
int number=0141;
printf("%c",number);
return 0;
}

  Compilation error  

  Compilation error  

1100001  

1100001  

a  

a  

97

97

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 is the output of below code?

#include <iostream>
using namespace std;
int main()
{
int number=0141;
printf("%c",number);
return 0;
}

  Compilation error  

  Compilation error  

1100001  

1100001  

a  

a  

97

97

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 is the output of below code?

#include <iostream>
using namespace std;
int main()
{
int number=0141;
printf("%c",number);
return 0;
}

  Compilation error  

  Compilation error  

1100001  

1100001  

a  

a  

97

97

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!"]

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/0

Accuracy

0%