CSCEA 201 Walden University Programming Problems

Description

1 attachmentsSlide 1 of 1attachment_1attachment_1

Unformatted Attachment Preview

CSCE A201 Midterm #1 v2
Name:
This exam is worth a total of 100 points. The exam is open book and open notes. You
can use a calculator or a computer but should be your own work. Show your work or
thought processes. You can insert your answers into this document and upload your final
answers or upload your answers in a separate document(s) that are compressed into a
single zip file.
1) 20 points. Short Answer.
a) What could go wrong with the code:
if (strvar == “hello”)
printf(“Hi there!n”);
b) Add parenthesis to the expression below to match the order that will be used in C
when evaluating the expression.
3 + 5 % 2 * 10
c) A variable of type char is used to store a character. Why does C allow you to
assign a number to a char variable, for example, char c = 65; ?
d) Fill in the blanks for the program below. The program should calculate the
product of the even integers from 1 to 15 (i.e. 2*4*6*8*10*12*14) and print it.
#include “stdio.h”
int main()
{
int product = ________;
for (int i=1; i 0)
{
value = value + count;
count = count – 2;
}
printf(“Value: %dn”, value);
3) 20 points. Bugs! Find and fix the bugs in the following code snippets.
a) The following code should output “big” if the input is exactly 100 and “small”
otherwise:
int value;
scanf(“%d”,&value);
if (value = 100)
printf(“bign”);
else
printf(“smalln”);
b) The following code should keep asking the user to enter a key until the key pressed
is ‘Y’ or ‘N’, at which point the loop should exit.
char c;
do
{
printf(“Try again? Press Y or N.n”);
scanf(” %c”,&c);
} while ((c!=’Y’) || (c!=’N’));
c) The following should input 5 numbers into the array.
int a[5];
int temp;
for (int i = 1; i

Purchase answer to see full
attachment

Explanation & Answer:
5 Problems

User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.

Reviews, comments, and love from our customers and community:

Article Writing

Keep doing what you do, I am really impressed by the work done.

Alexender

Researcher

PowerPoint Presentation

I am speechless…WoW! Thank you so much!

Stacy V.

Part-time student

Dissertation & Thesis

This was a very well-written paper. Great work fast.

M.H.H. Tony

Student

Annotated Bibliography

I love working with this company. You always go above and beyond and exceed my expectations every time.

Francisca N.

Student

Book Report / Review

I received my order wayyyyyyy sooner than I expected. Couldn’t ask for more.

Mary J.

Student

Essay (Any Type)

On time, perfect paper

Prof. Kate (Ph.D)

Student

Case Study

Awesome! Great papers, and early!

Kaylin Green

Student

Proofreading & Editing

Thank you Dr. Rebecca for editing my essays! She completed my task literally in 3 hours. For sure will work with her again, she is great and follows all instructions

Rebecca L.

Researcher

Critical Thinking / Review

Extremely thorough summary, understanding and examples found for social science readings, with edits made as needed and on time. Transparent

Arnold W.

Customer

Coursework

Perfect!

Joshua W.

Student

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>