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 :

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

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

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

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

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

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

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

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

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

Accuracy

0%

Comments