TCS NQT Input/Output Quiz- 2

Question 1

Time: 00:00:00
The missing block of code will be?

integer array[N]
Integer i=0;
max=0;
While i<N
   [missing code]
i=i+1
End while
Print max

If array[i]>max array[i]=max End If

If array[i]>max array[i]=max End If

If array[0]>max max=array[i] End If

If array[0]>max max=array[i] End If

If array[i]<max max=array[0] End if

If array[i]<max max=array[0] End if

If array[i]>max max=array[i] End if

If array[i]>max max=array[i] End if

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 will be the output of the following pseudo code

function f()
Integer  x,y,z
x=3,y=4,z=4;
print((z>=y>=x)?1:0);
End function

 

6

6

Zero(0)

Zero(0)

1

1

5

5

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 pseudo code

#include<stdio.h>
int main()

    int a,b=0;
    static int c[10] = {11,22,33,44,55,66,77,88,99,100};
    for(a=0;a<7;++a)
    {
        if((c[a]%2)==1)
        b+=c[a];
    }
    printf("%d",b);
    return 0;
}

255

255

176

176

180

180

200

200

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

#include<stdio.h>
Int main()
{
Int value=0,x=0;
for(x=0;x<5;x++)
{
    value++;
    Continue;
    printf(“%d”,x);
}

Zero(0)

Zero(0)

1

1

0123

0123

Noting will get printed on the output screen

Noting will get printed on the output screen

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 following code

Integer digit=0
If digit
Print 1
Else
Print digit
End if

1

1

Digit

Digit

Zero(0)

Zero(0)

Nothing will be printed

Nothing will be printed

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 following pseudo code

    read integer rose = 1, lotus =2;
    rose += lotus = rose
    Print rose
    Print lotus

 

21

21

12

12

11

11

22

22

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

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
Jacob wants to reuse the following loop inversely-> for (mile=0;mile<dest;mile++). Which of the options is most suited?

for(mile=dest; mile>0;mile--)

for(mile=dest; mile>0;mile--)

for(mile=dest; mile>=0;mile--)

for(mile=dest; mile>=0;mile--)

for(mile=dest-1; mile>-1;mile--)

for(mile=dest-1; mile>-1;mile--)

for(mile=dest-1; mile>0;mile--)

for(mile=dest-1; mile>0;mile--)

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

#include <iostream>
using namespace std;
int main()
{
    int skip_num;
    for(skip_num=1;skip_num<=5;skip_num++){
        if(skip_num==2|| skip_num==4){
            continue;
        }
        cout<<skip_num;
    }
    return 0;
}

1 3 4 5

1 3 4 5

1 4 5

1 4 5

2 4 5

2 4 5

1 3  5

1 3  5

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 the following code

#include<stdio.h>
int problem(int num);
int main()

    int solution = problem(1);
    printf("%d\n",solution);
}
int problem(int num)
{
    if(num > 5)
    exit(0);
    return(++num);
}

Zero(0)

Zero(0)

1

1

2

2

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 10

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

#include<iostream.h>
using namespace std;
int main () 
{
    int a=3, b=5;
    while(b--)
        a++;
    cout << a;
    return 0;
}

8

8

9

9

10

10

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

["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