If you post your answers, we'll be glad to verify them for you.
Main Topics
Browse All TopicsC Programming Quiz
This quiz consists of 20 multiple-choice questions. Please use the answer sheet at the end to enter the appropriate answer for each question (T, F, A, B, C etc).
1. The following pseudocode is an example of __________.
if conditionA is true then
if conditionB is true then
perform actions
endif
endif
A) a nested conditional structure
B) a simple conditional structure
C) a nested if-else-if conditional structure
D) none of the above
2. __________ is the standard symbol for representing a conditional structure in flowcharts?
A) diamond (or rhombus)
B) rectangle
C) circle
D) arrow
3. Which of the following is not a conditional operator in C?
A) !=
B) =
C) <
D) >
4. In C coded programs it is a syntax error to not properly indent code in nested conditional statements.
T) True
F) False
5. The following pseudocode is an example of __________.
if conditionA is true then
perform actionsA
else
perform actionsA
endif
A) a simple conditional structure
B) an error in logic (semantic error)
C) Both of the above
6. Which of the following is equivalent to not ( a < b ) ?
A) a < b
B) a = b
C) a > b
D) a >= b
7. Which of the following is equivalent to ( x < 3 ) ?
A) not ( x >= 3 )
B) not ( x = 3 )
C) not ( x > 3 )
D) not ( x <= 3 )
8. What is the output of the following pseudocode? (Assume the user enters 21 and all output is displayed on the same line)
input myNumber
if myNumber > 4 then
display myNumber
else
increase myNumber by 1
endif
display myNumber
A) 21
B) 2121
C) 2122
D) 2222
9. If P is true, Q is false and R is true which of the following expressions is false?
A) P or ( Q and R )
B) P or Q and R
C) P and Q or R
D) P and ( Q or R )
E) None of the above
10. The following C coded conditional statement is an example of __________.
if ( (age <= 17) && (age >= 21) ) {
printf("Hello Customer!\n");
}
A) a switch structure
B) a nested conditional statement
C) a semantic error
D) None of the above
11. The switch/case structure is a better alternative to __________ structures.
A) if-then-if
B) if-else-if
C) all nested conditional structures
D) if-then-if structures, but only when discrete logic paths have to be taken.
12. What will be the output of the following C coded program?
customerAge = 43;
if ( (customerAge <= 21) )
printf("%d ", customerAge);
printf("Hi ");
printf("customer!");
A) customer!
B) Hi customer!
C) 43 Hi customer!
D) None of the above
13. A __________ coded in C contains no main() function.
A) software library
B) function definition
C) function declaration
D) None of the above; all C coded programs must have a main() function.
14. printf() and scanf() are examples of programmer defined functions.
T) True
F) False
15. The following C statement is an example of a __________.
float convertToUSD(float, float);
A) Standard C Library function
B) function definition
C) function prototype
D) None of the above
16. A function is a(n) __________ program component that __________ some functionality which can be __________ without necessarily knowing its implementation details.
A) small, implements, hidden
B) complex, hides, reused
C) unknown, promotes, developed
D) stand-alone, encapsulates, reused
17. Which of the following statements is true?
A) Functions must always have input parameters.
B) Functions are ideal for promoting parallel implementation of a complex software system.
C) Functions make debugging extremely difficult since they require completion of the whole implementation before testing them.
D) Good function names are unimportant as long as good variables names as used.
18. sizeof is a valid name for a programmer defined function coded in C.
T) True
F) False
19. A function documentation prologue (aka routine level comments) is a form of internal documentation. The least amount of information it should include is:
A) description of the functions purpose in one or two sentences
B) description of the functions input parameters
C) description of the functions output data
D) all of above
20. __________ programming enables programmers to break complex systems into manageable components.
A) Structured
B) Division
C) Application
D) None of the above
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Ok, infinity, following are some of my answers that i think are correct.
1. A, 2. A, 3. i do not know, 4. F, 5. C, 6. do not know, 7. C, 8. I do not know, 9. I do not know, 10: D, 11. C, 12. I do not know, 13. B, 14. F, 15. C, 16. A, 17. A, 18. F, 19. D, 20. A
These are the answers i think are correct. Please help me out in this quiz. Thanks
>> 1. A,
Correct.
>> 2. A,
Correct.
>> 3. i do not know,
The question is about which of the operators are used to compare two values (equality, inequality, smaller than, etc.). Which of the ones listed is not such an operator ?
>> 4. F,
Correct. (it's still recommended though)
>> 5. C,
I assume this is correct, although the question is a bit weird. It's obviously a simple conditional statement (A). And in some ways you could see it as an "error in logic", since both cases have the same action.
>> 6. do not know,
What's the opposite of (a < b) ? In other words, if a is not smaller than b, then what can you say about a and b ?
>> 7. C,
No. If x is not larger than 3, is it possible that x is equal to 3 ?
>> 8. I do not know,
Start with the if statement. Is the condition true or false ? ie. wil the if block or the else block be executed ?
>> 9. I do not know,
You know that P is true, Q is false and R is true. What's the result of all listed statements ?
>> 10: D,
Is it possible to get into the if block ? For which value of 'age' ?
>> 11. C,
How would you replace a nested conditional structure with a switch statement ? What exactly does a switch statement do ? What would be the equivalent normal if statement ?
>> 12. I do not know,
Start with figuring out whether the if condition is true.
>> 13. B,
This question is confusing. I know which answer they are aiming for, but it's not as simple as that. Still, let's go for the answer they want ... Does the phrase make sense if you take your choice B ?
>> 14. F,
Correct. They are part of the standard I/O library.
>> 15. C,
Correct.
>> 16. A,
Another question that isn't really accurate. But again, I don't think A was the answer they intended ... Why would you hide a function ?
>> 17. A,
No. You can create a function without parameters :
void fun() { /* ... */ }
This function takes no parameters, and returns nothing.
There's only one of the 4 statements that makes somewhat sense.
>> 18. F,
Correct.
>> 19. D,
That's really a matter of taste and coding guidelines. But answer D makes the most sense indeed.
>> 20. A
Sounds good.
>> 3: A
!= is the "not equal to" operator - it tests for inequality ... so it is a comparison operator.
Think about the difference between the = and == operators.
>> 6: C
if a is not smaller than b, can a be equal to be ?
>> 7: A
Indeed. Use the same reasoning for question 6.
>> 8: This one i realy do not know.
Just take it line by line. The first line asks an input from the user, and stores it in the myNumber variable. The question mentions which value the user gives. Knowing that, what would happen with the if statement ?
>> 9: E
Indeed. All 4 of the statements are true.
>> 10: C
Yep. The if statement might as well not have been there, since it can never be true.
>> 11: B
Right.
>> 12: B
Good. You weren't tricked by the indentation of the 4th line :)
>> 13: I do not know the answer for this question and i thought B would be the best choice. It looks like C is also a candidate for right answer. Please let me know
Technically you're right that B and C are possible as answer, since it's indeed not possible for a function declaration or function definition to contain a main function (simply because those statements don't make sense at all). This is why I said the question is confusing.
But given that questions like these are looking for one specific answer ... which would you choose ? What is a main function used for, and when do you need it ?
>> 17: B
That's the one that makes somewhat sense indeed. With parallel implementation, they mean that multiple people/teams can work on different parts of the code at the same times.
Sorry for the delay - I've been on holiday for the whole weekend :)
>> 3:B
That's right. = is the assignment operator, while == is the equality comparison operator.
>> 5:A
As said earlier, I think the answer they were after was C (which you had originally). See http:#25253128
>> 6:B
If a is not smaller than b, does that mean that a is equal to b ?
I've got the impression that you're just guessing ... Don't guess - reason about it instead, and figure out the answer by logical deduction.
>> 8:B
Correct. Since 21 is larger than 4, the if block is executed, and the number 21 is displayed. After the if statement, the number is displayed once more.
>> 13:C
Try to answer the question I asked in http:#25254088 :
"What is a main function used for, and when do you need it ?"
The answer to that question will help you figure out the answer to question 13.
>> 16:D
D makes sense. So, let's go with that :)
Thank you Infinity. I also need help in writing the program for currency conversion with the following requirement. If you can help me out.
Write a currency Conversion Program that allows user to enter an amount of money (for a foreign currency of your choice), which is error checked as a valid entry, and then display its equivalency in U.S. Dollars. If on the other hand users input is invalid, the program should allow the user to reenter a new amount.
Business Accounts
Answer for Membership
by: cprogrammPosted on 2009-09-03 at 10:02:15ID: 25252617
I also have attached a file incase if it is not clear. Please help me out in this quiz.
This is a file in word and it is clear.