In: Computer Science
part a. In class we learned that the debugger, and _________ are effective in debugging C++ programs.
a. |
a logic analyzer |
|
b. |
print statements |
|
c. |
code reviews |
|
d. |
network analyzers |
part b. A ‘side-effect’ is
a. |
code written in a memory-efficient way |
|
b. |
a style of writing C++ statements that is risky. |
|
c. |
code written so that more than one thing is being done in one statement. |
|
d. |
(a) and (b) |
|
e. |
(b) and (c) |
|
f. |
none of the above |
part c. All the bitwise operators we learned take two arguments, except for &
True
False
part d. The following code fragment (assuming proper surrounding main(), etc.):
{
int i1;
}
cout << i1 << endl;
a. |
does not cause a compile-time error. |
|
b. |
causes a compile-time error, due to improper type usage |
|
c. |
causes a compile-time error, due to scoping issues |
|
d. |
causes a linker error |
a)
Debugger, and a logic analyzer are effective in debugging.
Option a correct choice
A logic analyzer used in both
Logical analyzer runs in high speed
Logical analyzer in general used in the hardware engineers to do debug.
b)
A ‘side-effect’ is code written in a memory-efficient way.
Option a correct choice
In practical try to avoid the side-effect.
It causes effect on the parameter passed by reference so the modification values found.
It is also causes effect on Modification of I/O operations as well as global variable value.
c)
All the bitwise operators we learned take two arguments, except for &
False
Since bitwise & take two arguments like other operators.
Example:
1&1 = 1
d)
The scope of a variable is within the brackets.
We can not access the variable out of the brackets where it declare.
If we use the variable out of scope(out of the brackets) it rasise an compiler error.
Observe the code:
{
int i1;
// i1 can accepted any where within the brackets
}
cout << i1 << endl; // Since i1 is out of scope it raises compile time error
Causes a compile-time error, due to scoping issues
Option c correct choice