WeCP C & C++ Quiz 1

Question 1

Time: 00:00:00
If inside of the main function someone write:

int c=12;

printf("%d %d %d",c++,++c,c++);

What will be the output for this?

12 14 15

12 14 15

14 15 12

14 15 12

13 13 15

13 13 15

13 13 14

13 13 14

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

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Suppose you have to delete an object, or deallocate its memory. The type of pointer about toto occur is

Null pointer

Null pointer

Integer Pointer

Integer Pointer

Pointer of its own data type

Pointer of its own data type

Dangling Pointer

Dangling Pointer

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 does int a:8 means?

Integer a has the value 8.

Integer a has the value 8.

Integer a has 8 digits

Integer a has 8 digits

There is an integer divided by 8

There is an integer divided by 8

Integer a has 8 bits

Integer a has 8 bits

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

Please login to submit your explanation

Start

Question 4

Time: 00:00:00

#include <stdio.h>
int main()
{
int *p;
int x=2;
p=&x;
printf("%d %d",*(p+1),*p+1);
}

What is the output  of the following code?

3 4

3 4

Garbage Garbage

Garbage Garbage

3 Garbage

3 Garbage

Garbage 3

Garbage 3

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

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
Suppose n is an integer. Which of the options is always unable to represent the total number of nodes in a saturated binary tree.

2n +1

2n +1

2^n + 1

2^n + 1

2^n - 1

2^n - 1

n+1

n+1

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

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
In case of Polymorphism, which of these cannot be overloaded?

Operators

Operators

Static member functions

Static member functions

Member functions

Member functions

Global functions

Global functions

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 a good way to make a 2d memorization matrix apart from the syntax:

map<int,map<int,int> > m; ?

vector<vector<int>> m;

vector<vector<int>> m;

map<<vector<int>,int> m;

map<<vector<int>,int> m;

map<pair<int,int>,int> m;

map<pair<int,int>,int> m;

list<list<int>> m;

list<list<int>> m;

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

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
int func(int i)
{
if(i==0||i==1) return i;
return i*func(i+1);
}
int main()
{
cout<<func(5);
}

Output of the following snippet is:

15

15

21

21

10

10

None of this

None of this

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 for the following code if r is 7 :
int main()
{
int i,r=7,j;
for(i=0;i<r;i++){
for(j=i;j<r;j++)
if(i==1 || j==i || j==r)
cout<<"*";
else
cout<<" ";
cout<<endl;
}
return 0;
}

  *   * * * * *  * * * *  * * * * * * * * * * * * * * * * * *

  *   * * * * *  * * * *  * * * * * * * * * * * * * * * * * *

  * * * * * * *   *           * *         * *       * *     * *   * * * *

  * * * * * * *   *           * *         * *       * *     * *   * * * *

* ******* * * * * *

* ******* * * * * *

  *******   *    * *   * *  * * * **

  *******   *    * *   * *  * * * **

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

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
Which of the functions only decreases the capacity of a string?

resize()

resize()

capacity()

capacity()

shrink_to_fit()

shrink_to_fit()

rend()

rend()

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%

Prime

Prime Mock

Complete Mock Subscription for WeCP

For WeCP
Get Prime Mock

Prime Video

Prime Video

Complete Video Course for WeCP

For WeCP
Prime Video
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

Comments