TCS NQT Input/Output Quiz- 3

Question 1

Time: 00:00:00

23.What will be the output of the following code below 



#include <iostream>
using namespace std;
void f(int *p,int *m){
   *m=*m+3;
   *p=*p+*m;
   return;
}
int main(){
   int i=5,j=6;
   int k=0;
   f(&i,&j);
   k=i*j;
   printf("%d",k);
   return 0;
}

138  

138  

126  

126  

135  

135  

134

134

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

Please login to submit your explanation

Start

Question 2

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

#include <iostream>
using namespace std;
int main()
{   int i,j,num=4;
   for(i=4;i>0;i--){
       for(j=num;j>1;j--){
           printf("*");
       }
       num--;
       printf("\n");
   }
   return 0;
}

****   ***     **       *

****   ***     **       *

***   **     *

***   **     *

*** ** *

*** ** *

None of the mentioned

None of the mentioned

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

#include <iostream>
using namespace std;
int main()
{
int i=16;
printf("%d%d",i<<1,i>>2);
return 0;
}

324

324

245

245

128

128

None of the mentioned

None of the mentioned

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 <iostream>
using namespace std;
float foo(int i);
int main()
{
   float x;
   x=foo(10);
   printf("%0.2f\t",x);
   return 0;
}
float foo(int i){
   float j=5;
   j=j/i;
   printf("%0.3f",j);
   return j;
}

0.5000.5  

0.5000.5  

0.5000.50  

0.5000.50  

0.50.5  

0.50.5  

0.500.5

0.500.5

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

#include <iostream>
using namespace std;

int main(){
 int a=4,b=2;
 int Exp=(a+b)/b;
 int Exp2=a+b/b;
 int Exp3=a+(b/b);
 printf("%d%d%d",Exp,Exp2,Exp3);
   return 0;
}

3 3 3  

3 3 3  

3 3 5  

3 3 5  

5 5 5  

5 5 5  

3 5 5

3 5 5

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

Please login to submit your explanation

Start

Question 6

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

READ integer coins=15 split=3 rest
--coins
rest=coins%split
Write rest

1

1

0

0

3

3

2

2

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

#include <stdio.h>
int main()
{
int i=3;
switch(i)
{
   case 0:printf("apple");
   break;
   case 1+0:printf("banana");
   break;
   case 5/2:printf("carrot");
   break;
   case 8%5:printf("dates ");
   break;
}
   return 0;
}

Apple  

Apple  

Banana  

Banana  

Carrot  

Carrot  

dates

dates

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


Read a=5

Initialize res & res1
res=a++
res1=++a
res--
--res1
res-=res1

-3

-3

-2

-2

-1

-1

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 <stdio.h>
int main()
{
int toys;
for(;;toys++)
{
printf("%d",toys);
if(toys++==4)
break;
}
}

Loops infinitely  

Loops infinitely  

024  

024  

Compilation error  

Compilation error  

01234

01234

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 the below code?
#include <iostream>
using namespace std;
int main()
{
  int a=0;
  if(a++){
      cout<<"YES";
  }
  else{
      cout<<"NO";
   }


    return 0;

}

YES

YES

NO

NO

Error

Error

No output

No output

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

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