Question

C Programming

Asked by: cprogramm

C 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.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-09-03 at 09:59:21ID24705240
Tags

C Programming QUIZ

Topic

C Programming Language

Participating Experts
1
Points
500
Comments
18

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

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.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

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.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

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.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. sizeof() problem
    Can any one tell me how sizeof() is implemented in Linux libc?? Below is my code,can any one tell me why doesn't the value of 'a' change?? main() { int a=10; int s=sizeof(a=20); printf("a = %d\n",a); } output a=10; So still 'a' is 10 even after reaasignm...
  2. Implementation of sizeof operator in C
    If I want to use my_sizeof instead of built-in sizeof operator in C, how could I write the code for my_sizeof? Usage of my_sizeof should be as follows: size_t i, j; i = my_sizeof(int); i = my_sizeof(j);
  3. printf and scanf
    I am trying to scan a word (string) in middle of a sentence. i am using printf and scanf.... (probably thats very basic, but i am still new to the stuff). i want to input a word and then be able to continue with the phrase without going to the next line example printf("...
  4. printf
    can anyone explain how printf works. is it's output implementation dependent? and also kindly explain the output for the following code. # include <stdio.h> void main() { int i=10; printf ("%d %d %d",i,++i,++i); } i got 12 12 11 i don't understan...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

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.

Join the Community

Answers

 

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.

 

by: Infinity08Posted on 2009-09-03 at 10:02:17ID: 25252618

If you post your answers, we'll be glad to verify them for you.

 

by: Infinity08Posted on 2009-09-03 at 10:03:01ID: 25252629

Or otherwise, tell us which ones you have a problem with.

 

by: cprogrammPosted on 2009-09-03 at 10:03:29ID: 25252638

Infinity i do not C programming a lot that is why am seeking help here. Please help me out here. Thanks

 

by: Infinity08Posted on 2009-09-03 at 10:11:00ID: 25252718

I am here to help you. But what would be the point if I just gave you the answers ? Why do you want/need these answers ?

 

by: cprogrammPosted on 2009-09-03 at 10:13:27ID: 25252741

Ok. Infninity i will do my best and send you the answers and then you can help me for the rest. Thanks, give me some time.

 

by: Infinity08Posted on 2009-09-03 at 10:22:16ID: 25252821

Take your time :) And don't hesitate to ask if you get stuck somewhere.

 

by: cprogrammPosted on 2009-09-03 at 10:31:50ID: 25252909

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

 

by: Infinity08Posted on 2009-09-03 at 10:56:48ID: 25253128

>> 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.

 

by: cprogrammPosted on 2009-09-03 at 11:56:14ID: 25253739

Following are the answers for:
3: A
6: C
7: A
8: This one i realy do not know.
9: E
10: C
11: B
12: B
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.
17: B

 

by: Infinity08Posted on 2009-09-03 at 12:30:12ID: 25254088

>> 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.

 

by: cprogrammPosted on 2009-09-04 at 06:53:55ID: 25259672

Infinity, thank you for your help;
for rest of the questions answers can be: Please let me know what you think. There could be other experts who can help me out.
3:B
5:A
6:B
8:B
13:C
16:D

 

by: cprogrammPosted on 2009-09-06 at 17:15:44ID: 25272117

Any body has any ideas on these solutions? Please help me out.

 

by: Infinity08Posted on 2009-09-08 at 01:38:02ID: 25279753

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 :)

 

by: cprogrammPosted on 2009-09-08 at 11:13:21ID: 25284545

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.

 

by: Infinity08Posted on 2009-09-08 at 11:15:00ID: 25284557

That should probably go into a new question ;)

 

by: cprogrammPosted on 2009-09-08 at 11:37:17ID: 25284739

that is right. Do you want me to put in a new thread? there are other questions for Quiz? Do you want me to post them here or in a new question as well.

 

by: Infinity08Posted on 2009-09-08 at 12:39:50ID: 25285419

A new thread/question would be best. That way, separate topics stay separate, and gives a more consistent PAQ database. Plus, it'll get you some new experts involved ;)

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...