
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Class: Intro Prog&Prob Solving; Subject: Engineering Computer Science; University: University of California - Davis; Term: Unknown 1989;
Typology: Exams
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Practice Midterm #2(Closed book and closed notes)
printf("Enter an integer>" ); scanf("%d",&x); product = x; count = 0; while (count < 4){ printf("%d\n",product); product *= x; count += 1; }
(b) In general, for a data value of any number n, what does this loop display?
if (cur_month == 1) printf("Happy New Year\n"); else if (cur_month == 6) printf("Summer begins\n"); else if (cur_month == 9) printf("Back to school \n"); else if (cur_month == 12) printf("Happy Holidays\n");
[...@pc...] cat tictactoe1.txt [...@pc...] cat tictactoe2.txt XXX XOX OOX OOO OXO XXO [...@pc...] a.out [...@pc...] a.out Enter the name of input file > tictactoe1.txt Enter the name of input file > tictactoe2.txt X won. O won.
[...@pc...] cat tictactoe3.txt [...@pc...] cat tictactoe4.txt XOX XOX XXO OOX OO X O [...@pc...] a.out [...@pc...] a.out Enter the name of input file > tictactoe3.txt Enter the name of input file > tictactoe4.txt tie. tie.