Sei sulla pagina 1di 10

Crystal Smith

My DCCCD

Test

Courses

Community

My Career

Review Test Submission: Test2

Review Test Submission: Test2


User

Crystal Smith

Test

Test2

Course

2016SP Programming Fundamentals I (COSC-1436-83400, COSC-1415-83400, COSC-141593403, COSC-1436-...)

Started

4/16/16 6:59 PM

Submitted

4/16/16 7:26 PM

Due Date

4/17/16 11:59 PM

Status

Completed

Attempt
Score

82 out of 100 points

Time Elapsed 27 minutes out of 1 hour

Question 1

2 out of 2 points

With a decision structure or ____ structure you ask a question, and, depending on the
answer, you take one of two courses of action.

Question 2

2 out of 2 points

A ____ is a basic unit of programming logic; each structure is a sequence, selection,


or loop.

Question 3

2 out of 2 points

if-else examples can also be called ____, because they contain the action taken
when the tested condition is true and the action taken when it is false.

Question 4

2 out of 2 points

A ____ can contain any number of tasks, but there is no chance to branch off and skip
any of the tasks.

Question 5
All logic problems can be solved using only the three structures____.

Question 6

2 out of 2 points

2 out of 2 points

The following pseudocode is an example of a ____ structure.


iffirstNumberisbiggerthansecondNumberthen
printfirstNumber
else
printsecondNumber

Question 7

2 out of 2 points

The popular name for logically snarled program statements is ____ code.

Question 8

2 out of 2 points

A group of statements that executes as a single unit is a(n) ____.

Question 9

0 out of 2 points

You can use an ____ statement to clearly show where the actions that depend on a
decision end.

Question 10

2 out of 2 points

In code, it is perfectly correct for one branch of the selection to be a do nothing


branch.

Question 11

0 out of 2 points

Most newer computer languages are unstructured and use syntax that lets you deal
efficiently with sequence, selection, and looping.

Question 12

0 out of 2 points

Whether you are drawing a flowchart or writing pseudocode, to represent decision


outcomes you can use either: Yes and No, or True and False.

Question 13

2 out of 2 points

What is the output of the following code?


charlastInitial='S';
switch(lastInitial)
{
case'A':
cout<<"section1"<<endl;
break;
case'B':
cout<<"section2"<<endl;
break;
case'C':
cout<<"section3"<<endl;
break;
case'D':
cout<<"section4"<<endl;
break;
default:
cout<<"section5"<<endl;
}

Question 14

2 out of 2 points

In a ____ control structure, the computer executes particular statements depending on


some condition(s).

Question 15

2 out of 2 points

Which of the following expressions correctly determines thatxis greater than10


and less than 20?

Question 16

Which of the following is a relational operator?

2 out of 2 points

Question 17

0 out of 2 points

Suppose thatxis anintvariable. Which of the following expressions always


evaluates to true?

Question 18

2 out of 2 points

Which of the following operators has the highest precedence?

Question 19

2 out of 2 points

What is the value of x after the following statements execute?


intx;
x=(5<=3&&'A'<'F')?3:4

Question 20

2 out of 2 points

Supposexis5andyis7. Choose the value of the following expression:


(x!=7)&&(x<=y)

Question 21

2 out of 2 points

The expression in an if statement is sometimes called a(n) ____.

Question 22

2 out of 2 points

The expression (x>=0&&x<=100)evaluates tofalseif eitherx<0


orx>=100.

Question 23

2 out of 2 points

A compound statement functions as if it was a single statement.

Question 24

0 out of 2 points

The result of a logical expression cannot be assigned to an int variable, but it can be
assigned to a bool variable.

Question 25

2 out of 2 points

What is the output of the following C++ code?


intj;
for(j=10;j<=10;j++)
cout<<j<<"";
cout<<j<<endl;

Question 26

0 out of 2 points

When a continue statement is executed in a ____, the update statement always


executes.

Question 27

0 out of 2 points

Which of the following statements generates a random number between 0 and 50?

Question 28

2 out of 2 points

What is the initial statement in the following for loop? (Assume that all variables are
properly declared.)
inti;
for(i=1;i<20;i++)
cout<<"HelloWorld";
cout<<"!"<<endl;

Question 29

2 out of 2 points

A loop that continues to execute endlessly is called a(n) ____ loop.

Question 30

2 out of 2 points

Which executes first in a do...while loop?

Question 31

2 out of 2 points

Which of the following loops does not have an entry condition?

Question 32

2 out of 2 points

Supposesum, num, and j are intvariables, and the input is 47129-1. What
is the output of the following code?
cin>>sum;
cin>>num;
for(j=1;j<=3;j++)
{
cin>>num;
sum=sum+num;
}
cout<<sum<<endl;

Question 33

0 out of 2 points

Consider the following code.


intlimit;
intreps=0;
cin>>limit;
while(reps<limit)
{
cin>>entry;
triple=entry*3;
cout<<triple;
reps++;
}
cout<<endl;

This code is an example of a(n) ____ while loop.

Question 34

2 out of 2 points

The control variable in a flag-controlled while loop is a bool variable.

Question 35

2 out of 2 points

The statement in the body of a while loop acts as a decision maker.

Question 36

2 out of 2 points

The number of iterations of a counter-controlled loop is known in advance.

Question 37

2 out of 2 points

A variable or expression listed in a call to a function is called the ____.

Question 38

2 out of 2 points

Given the following function prototype: doubletryMe(double,double);,


which of the following statements is valid? Assume that all variables are properly
declared.

Question 39

2 out of 2 points

Which statement below about prototypes and headers is true?

Question 40

2 out of 2 points

The statement: return2*3+1,1+5;returns the value ____.

Question 41

2 out of 2 points

The standard header file for the abs(x)function is ____.

Question 42

2 out of 2 points

Given the following function prototype: inttest(float,char);, which of


the following statements is valid?

Question 43

2 out of 2 points

To use the predefined function tolower, the program must include the header file
____.

Question 44

2 out of 2 points

Given the function prototype:


floattest(int,int,int);

which of the following statements is legal?

Question 45

2 out of 2 points

The statement: return8,10;returns the value ____.

Question 46

0 out of 2 points

The following function heading in a C++ program is valid:


intfuncExp(intu,charv,floatg)

Question 47

2 out of 2 points

The execution of a return statement in a user-defined function terminates the


program.

Question 48

2 out of 2 points

In C++, a function prototype is the function heading without the body of the function.

Question 49

The following return statement returns the value 10.

2 out of 2 points

return10,16;

Question 50

2 out of 2 points

Using functions greatly enhances a programs readability because it reduces the


complexity of the function main.
Saturday, April 16, 2016 7:26:44 PM CDT

OK

Potrebbero piacerti anche