wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

MARATHON C++ - SEASON1

Total questions: 22

Worksheet time: 11mins

Name
Class
Date
1.

C++ is an alias of C#

a)

False

b)

True

2.

What is a correct syntax to output "Hello World" in C++?

a)

cout << "Hello World";

b)

print ("Hello World");

c)

System.out.println("Hello World");

d)

cout << "Hello World"

3.

Which data type is used to create a variable that should store text?

a)

Txt

b)

string

c)

myString

d)

String

4.

How do you create a function in C++?

a)

Data type functionName() ;

b)

Data type functionName[] ;

c)

(functionName)

d)

functionName.

5.

How do you call a function in C++?

a)

functionName();

b)

functionName[];

c)

(functionName);

d)

functionName;

6.

How do you create a reference variable of an existing variable?

a)

With the REF word

b)

With the ref word

c)

With the ref word With the * operator

d)

With the & operator

7.

Which method can be used to find the length of a string?

a)

getSize()

b)

len()

c)

length()

d)

getLength()

8.

.Which operator is used to add together two values?

a)

The + sign

b)

The & sign

c)

The * sign

9.

The value of a string variable can be surrounded by single quotes.

a)

True

b)

False

10.

Why is a class useful in programming?

a)

are removed from memory when not in use

b)

bring together all aspects of an entity in one place.

c)

can closely model objects in the real world.

d)

permit data to be hidden from other classes.

11.

Which of the following keywords can’t appear inside a class definition?

a)

friend

b)

virtual

c)

static

d)

template

12.

Which of the following statements is true about inline functions?

a)

It's a compulsion on the compiler to make a function inline

b)

It's a request to the compiler to make the function inline

c)

It's the indication to the compiler that the function is recursive

d)

It's the indication to the compiler that the function is a member function

13.

Inline functions are avoided when

a)

function contains static variables

b)

function have recursive calls

c)

function have loops

d)

all of the mentioned

14.

What is the user-defined header file extension in c++?

a)

cpp

b)

h

c)

hg

d)

hf

15.

Which of the following keyword is used to declare the header file?

a)

include

b)

exclude

c)

string

d)

namespace

16.

What is the syntax of class template?

a)

template <parmaters> class declaration

b)

Template <parmaters> class declaration

c)

temp <parmaters> class declaration

d)

Temp <parmaters> class declaration

17.

C++ is

a)

procedural programming language

b)

object oriented programming language

c)

functional programming language

d)

both procedural and object oriented programming language

18.

Which of the following will not return a value?

a)

null

b)

void

c)

empty

19.

If the user did not supply the value, what value will it take?

a)

default value

b)

both default value & rise an error

c)

rise an error

d)

error

20.

Which of the following permits function overloading on c++?

a)

type

b)

number of arguments

c)

type & number of arguments

d)

number of objects

21.

Output of following program?

a)

Compiler Error

b)

c

c)

Garbage Value

d)

b

22.

is the following piece of code manifest overloading?

a)

True

b)

False