Hexaware Pseudo Code Quiz 1

Question 1

Time: 00:00:00
How many iteration are done to find 7 using binary search in pseudocode?
#include<iostream>
using namespace std;
int main()
{
arr[5] = {2, 6, 7, 9, 10};
return 0;
}

2

2

3

3

1

1

4

4

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

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Find the output of the following code?
#include<iostream>
using namespace std;
int main(){
int arr[6]= {2,4,6,8,10,12};
for(int i=0;i<6;i+=3){
cout<<arr[i]<<" ";
}
return 0;
}

2 6 10

2 6 10

4 8 12

4 8 12

2 8

2 8

2 10

2 10

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 value of sum in the following code for n =5?
#include<iostream>
using namespace std;
int main(){
int n, sum =0;
int i=0;
while(i<=n){
sum = i+n;
i+=2;
}
cout<<sum;
return 0;
}

21

21

9

9

10

10

11

11

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<iostream>
using namespace std;
int main(){
string str = "Prepinsta";
string s;
for(int i=0;i<str.length(); i+=2){
s += str[i];
}
s.pop_back();
cout<<s;
return 0;
}

Peis

Peis

Peisa

Peisa

eisa

eisa

Pisa

Pisa

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 will be the output of the code?
#include<iostream>
using namespace std;
int main(){
string str = "*";
string s;
for(int i=0;i<10; i+=3){
s += str[0];
if(i%2!=0) s+= "#";
}
cout<<s;
return 0;
}

**#**#

**#**#

#**#**

#**#**

***#***#

***#***#

#***#*

#***#*

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 code?
#include
using namespace std;
int main(){
int ans = ' ' * 10;
cout<<ans;
return 0;
}

320

320

10

10

20

20

340

340

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

using namespace std;
int main(){
int arr[5] = {2,4,3,5,6,};
for(int i=0 ; i<3; i++){
arr[i] = arr[i+1] + arr[i+2];
}
for(int i=0;i<5;i++){
cout<<arr[i]<<" ";
}
return 0;
}

7 8 11 8 9

7 8 11 8 9

7 8 11 5 6

7 8 11 5 6

1 3 4 5 6

1 3 4 5 6

8 5 3 2 10

8 5 3 2 10

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 following code do?
#include<iostream>
using namespace std;
int main(){
string s = "prepinsta";
int i=0;
for(int j=s.length()-1; j>=0; j--){
cout<<s[i];
i++;
}
return 0;
}

Reverse the string

Reverse the string

Don’t change the string

Don’t change the string

Remove the characters from string

Remove the characters from string

Print half characters from string

Print half characters from string

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

using namespace std;
int main(){
string s = "prepinsta";
int i=0;
for(int j=s.length()-1; j>=4; j--){
cout<<s[i];
i+=2;
}
return 0;
}

peise

peise

ppnta

ppnta

pepsa

pepsa

peita

peita

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 code do the ?
#include<iostream>
using namespace std;
int main(){
string str = "prepinsta";
int i=0, j=str.length()-1;
while(i<=j){
swap(str[i],str[j]);
i++;
j--;
}
return 0;
}

Don’t change the string

Don’t change the string

Reverse the string

Reverse the string

Swap the last character

Swap the last character

Delete the middle character

Delete the middle character

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%

Prime Mock

Prime Mock

Topic-Wise Full Mock and much more

For Hexaware
Prime Mock

Prime

Prime Video

Complete Video Course for Hexaware

For Hexaware
Prime Video

Comments