php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CS201 Solved mid term current MCQz 18 Ma 2011
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
Section 5.2 Essentials of Counter-Controlled Repetition

5.2 Q1: Which of the following does counter-controlled repetition require?

A condition that tests for the final value.
Counter-controlled repetition requires all of the above.
An increment or decrement by which the control variable is modified each time through the loop.
An initial value.

5.2 Q2: The statement
while ( --counter >= 1 )
counter % 2 ? cout << "A" : cout << "B";
cannot be rewritten as:


while ( --counter >= 1 )
if ( counter % 2 )
cout << "A";
else
cout << "B";.

while ( counter >= 1 )
if ( counter % 2 )
cout << "A";
else
cout << "B";.
--counter;

while ( --counter >= 1 )
counter % 2 == 0 ? cout << "B" : cout << "A";.

while ( counter > 1 )
{
--counter;
if ( counter % 2 )
cout << "A";
else
cout << "B";
}.

5.2 Q3: Which of the following is a bad programming practice?

Using floating-point values for counters in counter-controlled repetition.
Indenting the statements in the body of each control structure.
Nesting multiple repetition structures one within another.
Placing vertical spacing above and below control structures.

Section 5.3 for Repetition Statement
5.3 Q1: If a variable is declared in the initialization expression of a for structure, then:

It can not be used in any structures that are nested in that for structure.
It retains its final value after the loop is finished.
The scope of the variable is restricted to that particular for loop.
It is automatically reinitialized to zero once the loop is finished.

5.3 Q2: Which of the following is not true?

The initialization and increment expressions can be comma-separated lists.
You must declare the control variable outside of the for loop.
The three expressions in the for structure are optional.
A for loop can always be used to replace a while loop, and vice versa.

5.3 Q3: Consider the execution of the following for loop
for (int x = 1; x < 5; increment )
cout << x + 1 << endl;
If the last value printed is 5, which of the following might have been used for increment?

Any of the above.
x += 1.
a. x++.
++x.

Section 5.4 Examples Using the for Statement
5.4 Q1: Which of the following for headers is not valid?

for ( int i = 0; i < 10; i++ ).
int i = 0;
for ( ; i < 10; i++ ).
for ( int i = 0; int j = 5; ; i++ ).
for ( int i = 0: i < 10; ).

A Caution about Using Type double for Monetary Amounts
5.4 Q2: float and double variables should be used:

To perform monetary calculations.
To store true/false values.
As imprecise representations of decimal numbers.
As counters.

Using Stream Manipulators to Format Numeric Output
5.4 Q3: Which of the following is a parameterized stream manipulator used to format output?

setw.
right.
left.
fixed.

Section 5.5 do…while Repetition Statement
5.5 Q1: If a do…while structure is used:

Counter-controlled repetition is not possible.
The body of the loop will execute at least once.
An infinite loop will not take place.
An off-by-one error will not occur.

5.5 Q2: What will the following program segment do?
int counter = 1;
do {
cout << counter << " ";
} while ( ++counter <= 10 );

Cause a syntax error.
Print the numbers 1 through 11.
Print the numbers 1 through 9.
Print the numbers 1 through 10.

Section 5.6 switch Multiple-Selection Statement
5.6 Q1: A switch statement should be used:

As a multiple-selection structure.
As a single-selection structure.
To replace all if and if…else statements.
As a double-selection structure.

5.6 Q2: In a switch structure:

A default case is required.
A break is required after each case.
A break is required after the default case.
Multiple actions do not need to be enclosed in braces.

5.6 Q3: Which of the following is correct when labeling cases in a switch structure?

Case1.
Case 1.
case1.
case 1.

5.6 Q4: switch can be used to test:

all types of constants.
int constants.
string constants.
float constants.

5.6 Q5: Which of the following data types can be used to represent integers?

long.
short.
char.
All of the above.

Section 5.7 break and continue Statements
5.7 Q1: Which of the following is False?

break statements exit from the loop in which they are embedded.
continue statements skip the remaining statements in current iteration of the body of the loop in which they are embedded.
continue and break statements may be embedded within all C++ structures.
break and continue statements alter the flow of control.

5.7 Q2: Which of the following is False?

Many programmers feel that break and continue violate structured programming.
The effects of break and continue statements can be achieved by structured programming techniques.
You should always try to write the fastest, smallest code possible before attempting to make it simple and correct.
break and continue statements can perform faster than their corresponding structured techniques.

Section 5.8 Logical Operators
5.8 Q1: In C++, the condition ( 4 > y > 1 ):

Evaluates correctly and could be replaced by ( 4 > y && y > 1 ).
Does not evaluate correctly and should not be replaced by ( 4 > y && y > 1 ).
Does not evaluate correctly and should be replaced by ( 4 > y && y > 1 ).
Evaluates correctly and could not be replaced by ( 4 > y && y > 1 ).

5.8 Q2: The OR (||) operator:

Stops evaluation upon finding one condition to be true.
Associates from right to left.
Has higher precedence than the AND (&&) operator.
Is a ternary operator.

5.8 Q3: An operator that associates from right to left is:

().
!=.
?:.
,.

5.8 Q4: The expression if ( num != 65 ) cannot be replaced by:

if ( !( num == 65 ) ).
if ( num > 65 || num < 65 ).
d. if ( !( num – 65 ) ).
if ( num – 65 ).

5.8 Q5: An example of a unary operator is:

The < relational operator.
The = assignment operator.
The % arithmetic operator.
The ! logical operator.

Section 5.9 Confusing Equality (==) and Assignment (=) Operators
5.9 Q1: Variables are also known as:

rvalues, and cannot be used as lvalues.
lvalues, but can be used as rvalues.
Constant variables.
lvalues, and cannot be used as rvalues.

5.9 Q2: Consider the following code, assuming that x is an int with an initial value of 12
if( x = 6 )
cout << x;
What is the output?

12.
6.
A syntax error is produced.
Nothing.

5.9 Q3: Of the following, which is not a logic error?

Failing to initialize counter and total variables before the body of a loop.
Not placing curly braces around the body of an if that contains two statements.
Using commas instead of the two required semicolons in a for header.
Using == to assign a value to a variable.

Section 5.10 Structured Programming Summary
5.10 Q1: The ____________, __________ and ____________ are the only three forms of control necessary.

break, continue, if…else.
sequence, selection, repetition.
switch, if, else.
for, while, do…while.

5.10 Q2: Which of the following is not one of the C++ control structures?

if.
switch.
do…while.
main.

5.10 Q3: Which of the following is not one the rules for forming structured programs?

Any action state can be replaced by any control statement.
Any transition arrow can be reversed.
Begin with the “simplest activity diagram.”
Any action state can be replaced by two action states in sequence

Section 5.11 (Optional) Software Engineering Case Study: Identifying Objects’ States and Activities in the ATM System
5.11 Q1: Which of the following is not a part of a UML state diagram?

A solid circle indicating the initial state.
Arrows with accompanying event description text representing transitions.
Rounded rectangles representing states.
Fractions beside each state indicating the likelihood of entering that state.

5.11 Q2: An activity diagram for modeling the actions involved in executing a balance inquiry transaction using the BalanceInquiry object should not include:

Retrieving the user’s balance information from the database of accounts.
All of the above actions should be modeled in this activity diagram.
Receiving the user’s main menu input indicating a desire to inquire the amount of his or her balance.
Displaying the user’s balance information on the screen.

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Messages In This Thread
CS201 Solved mid term current MCQz 18 Ma 2011 - by Vuhelper - 05-18-2011, 04:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  BNK603 Consumer Banking Mid Term Papers Fall Semester 2012 Vuhelper 0 4,723 11-24-2012, 09:28 PM
Last Post: Vuhelper
  pak301- Final Term Solved Papers for 2011 Xpert 1 7,328 02-09-2012, 12:29 PM
Last Post: David
  eng201 midterm paper subjective 26th November, 2011 Xpert 2 4,946 11-27-2011, 05:27 PM
Last Post: Xpert
  ACC501 Midterm subjective paper shared by student 26th Noivember, 2011 Xpert 0 3,124 11-26-2011, 11:46 PM
Last Post: Xpert
  cs403 database management midterm current paper of fall 2011 on 26th November Xpert 0 2,842 11-26-2011, 11:35 PM
Last Post: Xpert
  CS507 mid term exam of today fall november 2011 Vuhelper 1 3,171 11-26-2011, 08:23 PM
Last Post: Vuhelper
  eco401 mid term today current paper fall november 2011 Vuhelper 0 3,138 11-26-2011, 08:21 PM
Last Post: Vuhelper
  acc501 mid term current solve paper fall November 2011 Vuhelper 0 3,550 11-26-2011, 08:08 PM
Last Post: Vuhelper
  CS601 Current Spring 2011 Final Term VU Paper 20 July 2011 Vuhelper 1 3,118 11-21-2011, 02:33 PM
Last Post: sid786
  MGT101 today's 25 july 2011 final term paper (subjective) naveed004 0 4,003 07-25-2011, 10:30 PM
Last Post: naveed004

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support