COP 2270 Exams 1-2, Final Questions
and Answers
Create a backwards for loop - Answer-for( int x = 10; x > 0; x -- ) { printf( "%d " , x ); }
Display the length of an array - Answer-printf( "Amount of items in array: %d\n", (int)
sizeof(array));
Create a while loop - Answer-while(condition) {commands}
Display minimum value between x and y is ?, and maximum value between a and b is?
- Answer-printf("Minimum Value between %6.2f and %6.2f = %6.2f and " , x, y, fmin( x,
y ));
printf("Maximum Value between %6.2f and %6.2f = %6.2f" , a, b, fmax( a, b ));
Convert and display this: char lowerLetter[] = "a"; to upper case - Answer-printf( "A
convert to %c" , to upper( lower Letter[0] ) );
Create a function named my Info() accepting your name, major and credits taken -
Answer-void myInfo( char name[], char major[], int credits Taken ) { commands }
What are these variables used for ( int; condition; increment ) - Answer-Regular for
loops
Call a function named myInfo() passing your name, major and credits taken - Answer-
myInfo( "Joe Smith", "IT", 15 );
The Sum of Numbers formula used with printf in this class is: - Answer-printf( "The Sum
of Numbers from 1 to 100 = %d\n" , (x + N)*(N/2) );
As learned in this class, the command line to compile an ANSI C program name test is -
Answer-gcc test.c -o test.exe
Display the Absolute Number of the value -190.75 - Answer-printf( "The process
Absolute Values of %6.2f is %6.2f" , -190.75, fabs( -190.75 ));
Create a forward for Loop step 1 from 1 to 10 - Answer-for( int x = 1; x < 10 + 1; x ++ )
{ printf( "%d " , x ); }
Which is an example of a single commented line of code in ANSI C - Answer-//this is a
test
Create the function named hello that receives a one dimension array named whoAmI. -
Answer-void hello( char whoAmI[] );
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller lectknancy. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $8.49. You're not tied to anything after your purchase.