Question 1

Time: 00:00:00
What will be the output of the following code?
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
// Write C++ code her
string str = "prepinsta";
for(int i=0;i<str.size(); i+=2){
cout<<str[i++];
}
return 0;
}

peisa

peisa

pps

pps

ppa

ppa

piepa

piepa

Question 2

Time: 00:00:00
What will be the output of the following code?
int main()
{
char a[] = "Prepinsta";
printf("%.*s",5,a);
return 0;
}

Prepi

Prepi

Insta

Insta

insta  

insta  

Compilation error

Compilation error

Question 3

Time: 00:00:00
What will be the output of the following program?
#include <iostream>
using namespace std;
int main()
{
int y=30;
while (y > 10)
{
y = y - 4;
}
cout<<y;
return 0;
}

10

10

8

8

20

20

Compiler error

Compiler error

Question 4

Time: 00:00:00
What is the output of below program?
int main()
{
if(0)
{
cout<<"Hello";
}
else
{
cout<<"Prepinsta";
}
return 0;
}

Hello  

Hello  

HelloPrepinsta

HelloPrepinsta

Prepinsta

Prepinsta

PrepinstaHello

PrepinstaHello

Question 5

Time: 00:00:00
What will be the output of the following code?
#include <iostream>
using namespace std;
int main() {
int a=10;
cout<<(++a)--<<" "<<a;
return 0;
}

9 11  

9 11  

11 12

11 12

11 10

11 10

10 12

10 12

Question 6

Time: 00:00:00
Choose the correct option by analyzing the given code
#include<stdio.h>
int x = 0;
int main(){
if(x == x)
{
printf("Delhi");
}
else
{
printf("Noida");

}
return 0;
}

else

else

Delhi

Delhi

Ifelse

Ifelse

Noida

Noida

Question 7

Time: 00:00:00
what will be the value of b of following code?
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int a=20, b= a+(a)++ + (++a);
cout<<(b++);
}

63

63

64

64

60

60

61

61

Question 8

Time: 00:00:00
What will be the output of the following pseudo code ?
#include<stdio.h>
void count(int n)
{
static int d=1;
printf("%d ",n);
printf("%d ",d);
d++;
if(n>1)
count(n-1);
printf("%d ",d);
}
void main()
{
count(3);
}

3 1 2 1 1 1 2  

3 1 2 1 1 1 2  

3 1 2 2 1 3 4 4 4  

3 1 2 2 1 3 4 4 4  

3 1 2 2 3 4  

3 1 2 2 3 4  

3 1 3 3 1 3 4 4 2

3 1 3 3 1 3 4 4 2

Question 9

Time: 00:00:00
What will be the output of the following code
#include<stdio.h>
int main()
{
for (int i = 10; i >= 0; i--) {
int k = i & (i >> 1);
if (k)
printf("%d ", i);
}

}

8 8 9

8 8 9

7 6 3

7 6 3

11 7 6 3

11 7 6 3

0 7 6 3

0 7 6 3

Question 10

Time: 00:00:00
What will be the output of the following code?
int main()
{
char a[] = "Prepinsta";
printf("%.*s",5,a);
return 0;
}

Prepi

Prepi

Insta

Insta

insta

insta

Compilation error

Compilation error

null
null

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