wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

LAS C++ Assignment: Datatypes, Variables and Operators

Total questions: 74

Worksheet time: 2hrs 28mins

Name
Class
Date
1.
What is this operator? +
a)
addition
b)
subtraction
c)
multiplication
d)
division
2.
What is this operator? -
a)
addition
b)
subtraction
c)
multilplication
d)
division
3.
What is this operator? *
a)
addition
b)

subtraction

c)
multiplication
d)
division
4.
What is this operator? /
a)
addition
b)
subtraction
c)
remainder
d)
division - only the whole number
5.
What is this operator? =
a)
Equal to
b)
Used in a calculation for equals
c)
and
d)
or
6.
What is this operator? >
a)
Greater than
b)
Less than or equal to
c)
Less than
d)
Greater than or equal to
7.
What is this operator? <
a)
Greater than
b)
Less than or equal to
c)
Less than
d)
Greater than or equal to
8.
What is this operator? >=
a)
Greater than
b)
Less than or equal to
c)
Less than
d)
Greater than or equal to
9.
What is this operator? <=
a)
Greater than
b)

Less than or equal to

c)
Less than
d)
Greater than or equal to
10.
What is this operator? %
a)
Concatenation
b)
Remainder or mod
c)
Division - only the whole number
d)
Escape character
11.
What is this operator? &&
a)
and
b)
or
c)
Remainder or mod
d)
Multiplication
12.
What is this operator? ||
a)
and
b)
or
c)
Remainder or mod
d)
Division
13.
What is this operator? ==
a)
Equal to
b)
Used in a calculation for equals
c)
and
d)
or
14.
What is this operator? !
a)
and
b)
or
c)
not
d)
equal to
15.
The process of creating a new variable without value
a)
declaration
b)
naming
c)
instantiation
d)
assigning
16.

What does <= mean?

a)

less than

b)

greater than

c)

less than or equal to

d)

greater than or equal to

17.

What is the only function all C++ programs must contain?

a)

start()

b)

system()

c)

main()

d)

program()

18.

What punctuation is used to signal the beginning and end of code blocks?

a)

{ }

b)

-> and <-

c)

BEGIN and END

d)

( and )

19.

Which of the following is a correct comment?

a)

*/ Comments */

b)

** Comment **

c)

/* Comment */

d)

{ Comment }

20.
The process of creating a new variable without value
a)
declaration
b)
naming
c)
instantiation
d)
assigning
21.

What does <= mean?

a)

less than

b)

greater than

c)

less than or equal to

d)

greater than or equal to

22.
A list of instructions that enable a computer to perform a specific task is a...
a)
Computer Program
b)
Algorithm
c)
Machine Code
d)
Binary Code
23.
Which command moves the shown text to the next line?
a)
\t
b)
\n
c)
\r
d)
\s
24.
After running the following code, what will be the value of x?
y = 3;
x = 5 * y;
a)
3
b)
5
c)
15
d)
0
25.
A programmer is:
a)
person who writes code and communicates instructions to a computer
b)
person who types
c)
person who studies computers
d)
error or mistake in your code
26.
What is the output of this program?
Program
int main()
{
cout<<"Hi everybody";
return 0;
}
a)
"Hi everybody"
b)
Hi everybody"
c)
Hi everybody
d)
"Hi everybody
27.
... variables store whole numbers (-4, 3, 51, etc). 
a)
Float
b)
Logical
c)
Character
d)
Integer
28.
... point variables store decimal numbers (3.5, -5,123, 4.0, etc). 
a)
Float
b)
Integer
c)
Logical
d)
Character
29.

Which of the following is NOT a logical operator in C++ language?

a)

&

b)

&&

c)

||

d)

!

30.

Evaluate the following expressions to true or false


3!=4-1

a)

true

b)

False

31.

Evaluate the following expressions to true or false


3!=4-1

a)

true

b)

False

32.

Evaluate the following expressions to true or false


5 >= (1+6)-4

a)

True

b)

False

33.

Evaluate the following expressions to true or false

5+1==6 || 8-1>4

a)

True

b)

False

34.

If originally x=2,y=0, and z=1, what is the value of x, y, and z after executing the following code?


if (x>y)


y=x;

else

z=x;

a)

x=2 y=2 z=1

b)

x=0 y=2 z=0

c)

x=2 y=1 z=1

d)

x=2 y=0 z=1

35.

c++ is an _____________ , developed by ______________ , and is an extension of c language

a)

object oriented program , Bjarane

b)

class and data

c)

complier, interpreter

d)

functions comments

36.

a program written in a high language is called a ____________

a)

object

b)

source code

c)

variable

d)

constant

37.

___________ is mostly first piece of code In c++

a)

Preprocessor

b)

compiler

c)

true

d)

false

38.

_________ are fixed values used by a program

a)

constant

b)

variable

c)

boolean

d)

float

39.

The assignment operator is used to assign a data type to a variable

a)

True

b)

False

40.

the <iostream .h> provides the basic INPUT and output fundamentales

a)

true

b)

false

c)

maybe

41.

in the _________, c++ only evaluates what is necessary from left to right to come up with the combined relational result.

a)

arithmetic operartor

b)

relational operator

c)

none

d)

Logical opeartor

42.

3==6!=7 is an example for associative operator

a)

True

b)

False

c)

None

43.

When using the ______________,C++ only evaluates what is necessary from left to right to come up with combined reational results,.

a)

logical operaters

b)

compound assignment

c)

associative

44.

the five arithmetic operators supported by c++

a)

+,-,*,/,%

b)

()$%

c)

{<>}

45.

Two expressions can be compared using ___________ operator.

a)

Logical

b)

Relational

c)

Arithmetic

46.

______ is used to input value from the user.

a)

cin>>

b)

cin<<

c)

<cin>

47.

what is the storage size of char

a)

1 byte

b)

10 bytes

c)

2 bytes

d)

8 bytes

48.

which escape sequence is used to move to the next line

a)

/n

b)

\n

c)

\N

d)

"/n"

49.

the size of the float datatype is

a)

2

b)

4

c)

8

d)

1

50.

_1Add is a valid variable name

a)

true

b)

false

51.

the different logical operators are

a)

&&,||,!

b)

&&,!! , !=

c)

&, || , !

d)

& , | , !

52.

Which operator returns the remainter of a division operation

a)

*

b)

+

c)

%

d)

/

53.

Double type data has a precision of ____________ decimal places

a)

12

b)

14

c)

15

d)

10

54.

the conditional statements terminates with a semicolon

a)

true

b)

false

55.
Arithmetic Operators
What is a % ?
a)
Multiplication
b)
Division
c)
Modulo
d)
Increment
56.

Suppose x=10, y=15, determine this expression:

x<=5||y<=15

a)

True

b)

False

57.

Assume a, b and c are int variables. Find the value assigned to c :

a=3;

b=4;

c=(a%b)*6;

a)

6

b)

16

c)

18

d)

24

58.

The valid combination of both operands and operators make an ______________ which return computed result.

a)

variable

b)

identifier

c)

expression

d)

syntax

59.

Which operator is also called as ternary operator

a)

arithmetic operator

b)

logical operator

c)

conditional operator

d)

Assignment operator

60.

The type of value that a variable will hold is called a

a)

keyword

b)

constants

c)

datatype

d)

identifiers

61.

Holds numbers with a decimal point

a)

String

b)

Float/Real

c)

Boolean

d)

Integer

62.

Holds alphanumerical data as text

a)

Integer

b)

String

c)

Real/Float

d)

Boolean

63.

Holds either 'True' or 'False'

a)

Character

b)

Boolean

c)

Float/Real

d)

String

64.

Holds a single alphanumerical character

a)

Character

b)

Boolean

c)

Float/Real

d)

String

65.

Holds whole numbers

a)

Integer

b)

String

c)

Character

d)

Boolean

66.

Your name should be saved as...

a)

String

b)

Boolean

c)

Integer

d)

Float

67.

Your age should be saved as a...

a)

String

b)

Boolean

c)

Integer

d)

Float/Real

68.

Your exact weight should be saved as a ...

a)

String

b)

Boolean

c)

Integer

d)

Float/Real

69.

A True or False response should be saved as a...

a)

String

b)

Boolean

c)

Integer

d)

Float/Real

70.

-99 is a ....... data type

a)

String

b)

Boolean

c)

Integer

d)

Float/Real

71.

0.1 is a ...... data type

a)

String

b)

Boolean

c)

Integer

d)

Float/Real

72.

House address data type is...

a)

String

b)

Boolean

c)

Integer

d)

Character

73.

Y answers is a .... data type

a)

String

b)

Character

c)

Boolean

d)

Integer

74.

Price is a .... datatype

a)

Float/Real

b)

String

c)

Integer

d)

Character