HIT365 – C Programming Quiz

HIT365 – C Programming Quiz 1 This quiz is worth 15% of the total unit. It is a closed book exam. Computers and calculators are not allowed in the quiz. Instruction The quiz of this unit will be held on line. The time and date of the quiz are as per unit information. Date: 16th April 2021 Time: 3:30pm to 5:30pm Upload scanned *.pdf document with your answers before 7pm 16th April 2021. You can submit photos taken with a mobile phone (put them in one Word file and save the Word file as a pdf file), provided the prints of the photos are readable. You must complete this quiz without the assistance of other persons and without the use of materials and/or aids which are not explicitly listed on the front cover of the quiz (including internet searches during the quiz times). To get ready for the test – Have sufficient blank pages available to write your answers on (20 pages recommended) – Have sufficient blue or black pens available Start the quiz The quiz will be released in pdf format in Learnline at the specified start time and date of the test. You can read the quiz as a pdf from a screen, or you can print the document and work from the printed document. Finish the quiz and submit Stop writing at the finish time mentioned above. Then proceed to scan your document and upload it to Learnline. You should complete uploading the document within 1 hour of the finish time of the quiz. Assistance during the test Your lecturer will be available via email during the quiz time. If you have any questions during the quiz or problems with completing or submitting your document, please email your lecturer immediately. Declaration Please note that by submitting the document of this assessment, you declare that all materials in your document is your own work except where there is a clear acknowledgement and reference to the work of others. You also declare that you have read the University’s Academic and Scientific Misconduct Policy and understand its implications. Question 1 (3 marks) Draw a flowchart and write a C program to check whether a given number is even or odd. Question 2 (2 marks) Write a C program to check two given integers whether either of them is in the range 100…200 inclusive. Question 3 (2 marks) Write a C program that allows the user to enter the radius of a sphere, calculates the sphere volume and displays the result. The volume of a sphere is V = 4/3*π*r3 where r is the radius of the sphere. Question 4 (1 mark) Is there a problem in the following program? If yes then what is it? #include int num; int main(void) { while ( num <= 100 ) { num = 3 * num; } printf(“%d”, num); } Question 5 (2 marks) Explain, using your own words, the purpose of putting “(float)” in front of the variable “total” in the following program. #include int main(void) { unsigned int counter; int grade; int total; float average; total = 0; counter = 0; printf( “%s”, “Enter grade, -1 to end: ” ); scanf( “%d”, &grade ); while ( grade != -1 ) { total = total + grade; counter = counter + 1; printf( “%s”, “Enter grade, -1 to end: ” ); scanf(“%d”, &grade); } if ( counter != 0 ) { average = ( float ) total / counter; printf( “Class average is %.2f\n”, average ); } else { puts( “No grades were entered” ); } } Question 6 (3 marks) Write a program in C that contains a function which receives two floating point numbers from the main function and returns the difference of the two floating point numbers to the main function. The main function prints the result in three decimal places. Question 7 (2 marks) In the following program, explain in detail, using your own words, the “while” loop condition. If the user enters “A”, what does the variable “grade” store? #include int main(void) { int grade; unsigned int aCount = 0; unsigned int bCount = 0; puts( “Enter a character.” ); while ( ( grade = getchar() ) != EOF ) { switch ( grade ) { case ‘A’: case ‘a’: ++aCount; break; case ‘B’: case ‘b’: ++bCount; break; default: printf( “%s”, “Incorrect letter grade entered.” ); puts( ” Enter a new grade.” ); break; } } puts( “\nTotals for each letter grade are:” ); printf( “A: %u\n”, aCount ); printf( “B: %u\n”, bCount ); }

Research Paper 101
Calculate your paper price
Pages (550 words)
Approximate price: -

Reasons to trust Research Paper 101

On Time Delivery

We pride ourselves in meeting the deadlines of our customers. We take your order, assign a writer but allow some more time for ourselves to edit the paper before delivering to you. You are guaranteed a flawless paper on a timely manner...

24x7 Customer Live Support

Our team at Research Paper 101 is committed to handling your paper according to the specfications and are available 24*7 for communication. Whenever you need a quick help, you can talk to our writers via the system messaging or contact support via live chat and we will deliver your message instantly.

Experienced Subject Experts

Online Experts from Research Paper 101 are qualified both academically and in their experiences. Many are Masters and Phd holders and therefore, are qualified to handle complex assignments that require critical thinking and analyses...

Customer Satisfaction

We offer dissertation papers as per students’ wishes. We also help craft out the best topics and design concept papers. By ordering with us, you are guaranteed of defending and making through those hard faced professors in the defense panel!

100% Plagiarism Free

We at Research Paper 101 take plagiarism as a serious offence. From the start, we train our writers to write all their papers from scratch. We also check if the papers have been cited appropriately. Our website also has a tool designed to check for plagiarism that has been made erroniusly. In essense, the paper you get will be 100% legit...

Affordable Prices

We understand that being a student is very challenging, some students balance between work and studies in order to survive. We therefore offer pocket friendly rates that are very competitive in the market.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

error: