Font size
WorksheetsLAS C++ Assignment: Datatypes, Variables and Operators
Total questions: 74
Worksheet time: 2hrs 28mins
subtraction
Less than or equal to
What does <= mean?
less than
greater than
less than or equal to
greater than or equal to
What is the only function all C++ programs must contain?
start()
system()
main()
program()
What punctuation is used to signal the beginning and end of code blocks?
{ }
-> and <-
BEGIN and END
( and )
Which of the following is a correct comment?
*/ Comments */
** Comment **
/* Comment */
{ Comment }
What does <= mean?
less than
greater than
less than or equal to
greater than or equal to
y = 3;
x = 5 * y;
Program
int main()
{
cout<<"Hi everybody";
return 0;
}
Which of the following is NOT a logical operator in C++ language?
&
&&
||
!
Evaluate the following expressions to true or false
3!=4-1
true
False
Evaluate the following expressions to true or false
3!=4-1
true
False
Evaluate the following expressions to true or false
5 >= (1+6)-4
True
False
Evaluate the following expressions to true or false
5+1==6 || 8-1>4
True
False
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;
x=2 y=2 z=1
x=0 y=2 z=0
x=2 y=1 z=1
x=2 y=0 z=1
c++ is an _____________ , developed by ______________ , and is an extension of c language
object oriented program , Bjarane
class and data
complier, interpreter
functions comments
a program written in a high language is called a ____________
object
source code
variable
constant
___________ is mostly first piece of code In c++
Preprocessor
compiler
true
false
_________ are fixed values used by a program
constant
variable
boolean
float
The assignment operator is used to assign a data type to a variable
True
False
the <iostream .h> provides the basic INPUT and output fundamentales
true
false
maybe
in the _________, c++ only evaluates what is necessary from left to right to come up with the combined relational result.
arithmetic operartor
relational operator
none
Logical opeartor
3==6!=7 is an example for associative operator
True
False
None
When using the ______________,C++ only evaluates what is necessary from left to right to come up with combined reational results,.
logical operaters
compound assignment
associative
the five arithmetic operators supported by c++
+,-,*,/,%
()$%
{<>}
Two expressions can be compared using ___________ operator.
Logical
Relational
Arithmetic
______ is used to input value from the user.
cin>>
cin<<
<cin>
what is the storage size of char
1 byte
10 bytes
2 bytes
8 bytes
which escape sequence is used to move to the next line
/n
\n
\N
"/n"
the size of the float datatype is
2
4
8
1
_1Add is a valid variable name
true
false
the different logical operators are
&&,||,!
&&,!! , !=
&, || , !
& , | , !
Which operator returns the remainter of a division operation
*
+
%
/
Double type data has a precision of ____________ decimal places
12
14
15
10
the conditional statements terminates with a semicolon
true
false
What is a % ?
Suppose x=10, y=15, determine this expression:
x<=5||y<=15
True
False
Assume a, b and c are int variables. Find the value assigned to c :
a=3;
b=4;
c=(a%b)*6;
6
16
18
24
The valid combination of both operands and operators make an ______________ which return computed result.
variable
identifier
expression
syntax
Which operator is also called as ternary operator
arithmetic operator
logical operator
conditional operator
Assignment operator
The type of value that a variable will hold is called a
keyword
constants
datatype
identifiers
Holds numbers with a decimal point
String
Float/Real
Boolean
Integer
Holds alphanumerical data as text
Integer
String
Real/Float
Boolean
Holds either 'True' or 'False'
Character
Boolean
Float/Real
String
Holds a single alphanumerical character
Character
Boolean
Float/Real
String
Holds whole numbers
Integer
String
Character
Boolean
Your name should be saved as...
String
Boolean
Integer
Float
Your age should be saved as a...
String
Boolean
Integer
Float/Real
Your exact weight should be saved as a ...
String
Boolean
Integer
Float/Real
A True or False response should be saved as a...
String
Boolean
Integer
Float/Real
-99 is a ....... data type
String
Boolean
Integer
Float/Real
0.1 is a ...... data type
String
Boolean
Integer
Float/Real
House address data type is...
String
Boolean
Integer
Character
Y answers is a .... data type
String
Character
Boolean
Integer
Price is a .... datatype
Float/Real
String
Integer
Character
