wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C++ Is Fun

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which among the below is correct?

a)

#include "stdio.h"

b)

#include <stdio.h>

c)

#include <stdio>

d)

#include "stdio"

2.

What is wrong (if any) in the code?

a)

CBase : Function()

b)

CDerived : Function()

c)

CBase : Function()

CDerived : Function()

d)

Compilation Error

3.

What will be the output to the program?

a)

x is greater than or equal to y

b)

x is greater than y

c)

x is smaller than y

d)

Compiler Error or Warning

4.

What is the below code example of?

int myFunction(int x);

float myFunction(float x);

double myFunction(double x, double y);

a)

Operator overloading

b)

Polymorphism

c)

Function Overloading

d)

Functional Parameters

5.

Select the correct format for selecting elements in the array of 3 integers.

a)

arr[0]

arr[1]

arr[2]

b)

*(arr + 0);

*(arr + 1);

*(arr + 2);

c)

(arr + 0);

(arr + 1);

(arr + 2);

d)

&(arr + 0);

&(arr + 1);

&(arr + 2);

6.

What will happen in the below situation?

int arr[5] = {1,2,3};

int nget = arr[5];

a)

Compiler Warning

b)

Compiler Error

c)

Crash

d)

Garbage Value

7.

Predict the output to the below -

int* pNum = new int;

*pNum = 10;

free(pNum);

4 lines
8.

Below is an example of

int *pNum = new int;

*pNum = new int;

(a)  

9.

What is the wrong the given code?

(a)  

10.

What is wrong with the code?

a)

static is not declared as const

b)

GetValue() will return the value

c)

"i" is uninitialized in the GetValue()

d)

return values should be included in "(", ")"