stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Quiz No2 Cpe 1B Flashcards | StudBud
Explore
/
Quiz No2 Cpe 1B
Quiz No2 Cpe 1B
50 terms
·
StudBud Administration
·
36 plays
Imported from external platform
Flashcards
50 cards
F
Practice quiz
P
Host live
L
Questions
50
Answers
1
Evaluate the following expressions if a=9, b=6 and c=2. 100 / ( a * c + c )
0
5
25
15
2
Evaluate the following expressions if a=9, b=6 and c=2. ( b + c ) mod a + 20 – a * b / c
1
0
9
-1
3
What is the result of the following code?
Zero
Hello World
ZeroHello World
One
4
This is a variable declared in the main body of the source code, outside all functions.
Local variable
Single variable
Constant variable
Global variable
5
This type of error are mostly related to numeric calculations.
logic error
syntax error
There is no such thing
run time error
6
What is required to avoid falling through from one case to the next?
end;
A semicolon.
Stop;
break;
7
If A = 30 and B = 12, What is the binary equivalent of A^ B?
0001 0010
0001 0000
0000 1010
0001 1000
8
Which of the following is the correct operator to shorten some expressions?
/* and */
{ } and ( )
++ and --
// and “”
9
Evaluate the following expressions if a=9, b=6 and c=2; a * b - 4 mod c
54
52
18
16
10
What does endl do?
Nothing
Ends the program
Adds a new line
Ends the function
11
Use signed or unsigned if you intend to store numerical values in a double-sized variable.
There is no such thing.
Not sure
False
True
12
Escape code for tab.
\t
\v
/t
\a
13
Which of the following shows the correct syntax for an if statement?
expression if
if ( expression )
if { expression }
if expression
14
Which of the following is the boolean operator for logical-and?
|&
&&
| |
&
15
This variable is one declared within the body of a function or a block.
Constant
Global variable
Single variable
Local variable
16
This is an statement consists of a boolean expression followed by one or more statements.
switch
if
Relational
option
17
Which of the following is the Bitwise exclusive OR and assignment operator?
| =
^ =
/ =
& =
18
In switch statement, if none of the case values match the expression listed after the select statement, it will fall to?
If
If-else
Default
Else
19
Which of the following is the Equality operator?
<, <+, <=, >=
<<, >>
= =, ! =
* / %
20
In if syntax, statement(s)
may either be a single statement or a block of statements
False
True
21
Which one of these is NOT a type of error in programming?
Spelling
Logic
Syntax
Run-time
22
The use of braces is required where only a single statement appears in an if statement .
False
True
23
For formatted input operations, cin is used together with the extraction operator, which is written as <<.
There is no extraction operator
False
True
Not sure
24
What punctuation is used to signal the beginning and end of code blocks?
{ }
<!- ->
[ and ]
( and )
25
Which of the following is a correct comment?
\* Comment*\
*/ Comments */
{ Comment }
/* Comment */
26
endl; or the escape sequence "\n" moves the reading position down a line.
False
True
27
A variable can be either of global or local scope.
Not sure
There is no such thing.
False
True
28
In switch, what keyword covers unhandled possibilities?
all
contingency
other
default
29
The ladderized
if-else
statement is used to if there are one outcome expected in a program.
False
True
30
cin, cout, and endl all belong to what namespace?
C++
print
std
io
31
This will be the result of violation of the syntax (the grammar rules) of the programming language that you use.
Not sure
Syntax error
Run time error
Logic error
32
Escape codes for form feed or page feed.
\p
\f
\b
\e
33
Evaluate the following expressions if a=9, b=6 and c=2. – a * b
45
54
- 54
- 45
34
A variable can be either of global or local scope.
False
There is no such thing.
Not sure
True
35
Which of the following is not a correct variable type?
float
int
double
real
36
Programming is . . .
The art of creating a program.
The action of scheduling something.
37
13. What’s the following snippet output? bool boolean = false; boolean = -5; Cout << boolean << endl;
false
1
0
true
38
if a =3, b=2 and c = 12; evaluate the value of X ; X = ( c >= b ) AND ( b <> b ) AND ( 3 <= a )
No output
True
No sure
False
39
Evaluate the following expressions if a=9, b=6 and c=1.5. a mod b*c
3
0
1
2
40
Evaluate the following expressions if a=9, b=6 and c=2. 6 * (b + c) – a
-9
30
39
-39
41
This will be the result of incorrect translation of your algorithm when you were writing the program.
Run time error
Logic error
Syntax error
Not sure
42
This can be initialize with any valid string literal just like numerical type variables to any valid numerical literal.
Datatypes
Variables
Constant
Strings
43
Which of the following is the Realational operator?
<<, >>
+, -
<, <=, >, >=
= =, ! =
44
If A = 30 and B = 12, What is the binary equivalent of A&B?
0000 1100
0000 0100
0000 1101
0000 1010
45
"if (8 >10) cout<<"oof"<<endl; "
Will print out oof...
never
sometimes
always
oof
46
Signed and unsigned may also be used as standalone type specifiers.
There is no such thing.
False
Not sure
True
47
What punctuation ends most lines of C++ code?
<<
:
;
‘
48
01100010 in Hexadecimal?
62
12A
98
16
49
cout is ...
a local variable of type ostream
a function
an overloaded operator
a global variable of type ostream
50
C++ supports two types of conditional statements:
if
and switch statements.
True
False