Answer the following statements true (T) or false (F)

1. Consider two blocks, one within another. If an identifier is declared as a variable in
the inmost of these two blocks, one can access this variable from the outer block.
2. Consider two blocks, one within another. C++ prohibits an identifier to be declared as
a variable in each of these blocks.
3. Calling something a black box is a figure of speech that conveys the idea that you
cannot see inside. You know its behavior and interface but not its implementation.
4. When a loop is nested in side another loop, a break or continue statement
terminates or restarts the outermost loop of the nested loop structure.


1. False:
The scope of a local variable extends from the definition to the end of
the block in which the variable is defined. This excludes the outer block.
2. False
Without the inner variable, the scope of the outer variable would be the
entire outer block, including the inner block. The variable with the inner block for its
scope shadows the outer variable’s scope, making a hole in the scope of the outer
variable.
3. True
If a function is well designed, a client programmer can use it without
knowing the internals. All the programmer needs to know is that if the preconditions
on the arguments are met, all he or she has to do is to name the function and enter the
arguments. The black box will take care of everything else.
4. False
A break or continue terminates or restarts only the innermost loop
containing the break or continue.

Computer Science & Information Technology

You might also like to view...

# has a special set of operators known as ____________ that change the value of a variable without having to type the variable name twice.

a. identity operators b. combined assignment operators c. quick-change operators d. assessment operators

Computer Science & Information Technology

What is the output of the following code?

``` #include using namespace std; class Foo { public: int x; // data field int y; // data field Foo() { x = 10; y = 10; } void p() { int x = 20; // local variable cout << "x is " << x << " "; cout << "y is " << y << endl; } }; int main() { Foo foo; foo.p(); return 0; } ``` a. x is 20 y is 10 b. x is 10 y is 20 c. x is 20 y is 20 d. x is 10 y is 10

Computer Science & Information Technology

Which of the following is NOT in a TCP header?

A. Source port B. TTL C. Sequence number D. Window

Computer Science & Information Technology

What is the common term for a VLAN based on MAC addresses?

A. static vlan B. routed vlan C. dynamic vlan D. managed vlan

Computer Science & Information Technology