100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CCPS 393 exam questions & answers 2024/2025 $9.49   Add to cart

Exam (elaborations)

CCPS 393 exam questions & answers 2024/2025

 1 view  0 purchase
  • Course
  • CCPS 393
  • Institution
  • CCPS 393

CCPS 393 exam questions & answers 2024/2025 C - ANSWERSC Explain the difference between %d and %4d placeholders when printing - ANSWERS%4d reserves 4 spaces and right aligns the text, e.g 4285 6 but %d would just be centered write the commands to read a string from input and print ...

[Show more]

Preview 3 out of 16  pages

  • September 21, 2024
  • 16
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • CCPS 393
  • CCPS 393
avatar-seller
Bensuda
CCPS 393 exam questions & answers
2024/2025

C - ANSWERSC



Explain the difference between %d and %4d placeholders when printing - ANSWERS%4d reserves 4
spaces and right aligns the text, e.g

4285

6



but %d would just be centered



write the commands to read a string from input and print it out. Assume a macro is define with max size
SZ - ANSWERSchar s[SZ];

printf("Enter a string with max size %d: ", SZ);

fgets(s, SZ, stdin);

s[strlen(s) - 1] = '\0';

printf("You entered: %s \n", s);



Write the "cookbook" steps to reading/writing from a file - ANSWERSdeclare file pointers:

FILE* in;

FILE* out;



initialize pointers:

in=fopen("filename", "r");

out=fopen("filename", "w");



actions:

,fscanf(in, "placeholder", &variable);

fprintf(out, "placeholder", variable);



close files:

fclose(in);

fclose(out);



write the general syntax for a switch statement - ANSWERSswitch (variable) {

case (cond1):

action1;

break;



case (cond2):

case (cond3):

action2;

break;

}



fill in the blanks:



void swap (int *a, int *b) {

int temp;

temp=____; // set to variable pointed to by a

____ = ____; // set variable pointed to by a to the one pointed to by b

____ = temp; // set the variable pointed to by b

}



int main() {

int a=5, b=7;

, swap( ____, ____); // a is now 7, b is now 5

return 0;

} - ANSWERS*a

*a = *b

*b



swap(&a, &b)



write out the general format for a makefile - ANSWERStargetfile : dependenciesfiles

action (gcc ...)

targetfile2 : dependeciesfiles2

action

... and so on



the executable show_face depends on object files show_face.o and face.o



show_face.o depends on the source file show_face.c



face.o depends on the source file face.c



write the makefile - ANSWERSshow_face : show_face.o face.o

gcc show_face.o face.o -o show_face

show_face.o : show_face.c

gcc -c show_face.c

face.o : face.c

gcc -c face.c

clean:

rm *.o

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

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

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

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 Bensuda. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $9.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

78462 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$9.49
  • (0)
  Add to cart