Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

CISC105 Midterm 1 Sample Questions from Previous Exams NAME General instructions: There are problems worth a total of points . Read the problems very carefully. Identify what kind of answer the problem asks for. Carefully look at requirements for input

Beoordeling
-
Verkocht
-
Pagina's
17
Cijfer
A+
Geüpload op
04-12-2024
Geschreven in
2024/2025

CISC105 Midterm 1 Sample Questions from Previous Exams NAME General instructions: There are problems worth a total of points . Read the problems very carefully. Identify what kind of answer the problem asks for. Carefully look at requirements for input and output, and any restrictions on how your code must be written. You may assume that input will not produce errors for the procedures described, unless the questions says otherwise. Do problems you are confident about first. If you finish the problems you know, write what you do know about other problems to gain partial credit; but erroneous information may detract from that credit or irritate the grader, so don’t make stuff up. Do not do unnecessary testing. For example, testing for both x 0 and x = 0 instead of using one test and then else would be considered unnecessary testing. Do not make code unnecessarily inefficient. Short answer. Use only the space provided. 1. What values are true in C? 2. What does the C statement “int q;” do inside the computer, as discussed in class? 3. Is #include a reserved word in C? Explain your answer very briefly. 4. When would you use a sentinel-controlled loop? 5. (6 pts) Write two complete examples, one of each of the preprocessor directives we have reviewed in class. 6. What is the main issue, as discussed in class, that you must consider when choosing asentinel? 7. Structured programming says that all programs can be written using a combination ofthree kinds of control structures. What are they? 8. You are told to write some code that will execute 100,000 times. As discussed in class,which type of loop should you probably use? 9. You are told to write a sentinel-controlled loop. As discussed in class, which type ofloop should you probably use? 10. You are told to write a loop that runs until the user enter a Carmichael number. Asdiscussed in class, which type of loop should you probably use?

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

CISC105 Midterm 1 Sample Questions from Previous Exams

NAME


General instructions:
There are problems worth a total of points . Read the problems very carefully. Identify what
kind of answer the problem asks for. Carefully look at requirements for input and output,
and any restrictions on how your code must be written.
You may assume that input will not produce errors for the procedures described, unless
the questions says otherwise.
Do problems you are confident about first. If you finish the problems you know, write
what you do know about other problems to gain partial credit; but erroneous information
may detract from that credit or irritate the grader, so don’t make stuff up.
Do not do unnecessary testing. For example, testing for both x < 0 and x >= 0 instead
of using one test and then else would be considered unnecessary testing.
Do not make code unnecessarily inefficient.
Short answer. Use only the space provided.

1. What values are true in C?


2. What does the C statement “int q;” do inside the computer, as discussed in class?


3. Is #include a reserved word in C? Explain your answer very briefly.


4. When would you use a sentinel-controlled loop?


5. (6 pts) Write two complete examples, one of each of the preprocessor directives we have
reviewed in class.


6. What is the main issue, as discussed in class, that you must consider when choosing a
sentinel?


7. Structured programming says that all programs can be written using a combination of
three kinds of control structures. What are they?


8. You are told to write some code that will execute 100,000 times. As discussed in class,
which type of loop should you probably use?

, 9. You are told to write a sentinel-controlled loop. As discussed in class, which type of
loop should you probably use?


10. You are told to write a loop that runs until the user enter a Carmichael number. As
discussed in class, which type of loop should you probably use?


11. (6 pts) Write two complete examples, one of each of the preprocessor directives we have
reviewed in class.


12. (4 pts) When you load a C program, what physical part of the computer does it come
from?


13. (6 pts) What are the structures we have studied in class so far for accomplishing
selection of code in C?


14. (12 pts) Write the appropriate shell command next to each task:

(a) compile a C program
(b) list the contents of a file
(c) show the location of the current directory
(d) create a new directory
(e) make a copy of a file



15. (4 pts) What is binary 1001001101011010 in hex?




16. (4 pts) What is binary 1101101 in decimal?




17. (4 pts) What is decimal 567 in hex?




18. (4 pts) What is decimal 322 in binary?

, 19. (4 pts) Advocates of this philosophy proved that all programming could be done using
only sequence, selection, and repetition. What is its name?



20. (4 pts) Write the binary equivalent of the decimal number 157.




21. (10 pts) Write a for loop using the variable provided that prints the following output:

% a.out
2 5 8 11 14
%

int i;


22. 12 pts. Write the six stages of a C program in order. Next to each, write the shell
command that accomplishes it.
For the next section, choose the letter that shows the value that would be in x. Assume
x and y are declared as integers. Choose “error” if you think a fragment will not
compile and run. The fragments are unrelated (each question is separate from the
others). HINT: Calculate your answer before you look at the selections.

23. (2 pts)

x = 2 - 3 * 2 - 7;

(a) 5 (b) 11 (c) 2 (d) error (e) none of the above

24. (2 pts)

x = 2 + 3 || 2 < 3;

(a) 5 (b) 0 (c) 1 (d) error (e) none of the above

25. (2 pts)

y = 3.6;
x = (double)y * 2;

(a) 7.2 (b) 7 (c) 6 (d) error (e) none of the above

26. (2 pts)

x = 15 % 3;

(a) 5 (b) 1 (c) 3 (d) error (e) none of the above

Geschreven voor

Vak

Documentinformatie

Geüpload op
4 december 2024
Aantal pagina's
17
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$13.99
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
NursingCourses

Maak kennis met de verkoper

Seller avatar
NursingCourses Mindrift
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
1 jaar
Aantal volgers
1
Documenten
209
Laatst verkocht
-
Nursing Courses Q &amp; A

Welcome to your one-stop shop for academic excellence! My meticulously crafted notes are designed to ensure you achieve the highest grades in your exams. With a deep understanding of the curriculum and a focus on clarity, these notes are packed with key concepts, detailed explanations, and exam-focused content. Whether you're struggling to grasp complex topics or just need a reliable study companion, these notes will guide you through your course with ease. I’ve distilled the essence of each subject into clear, concise material that’s easy to understand and even easier to apply in your exams. Why Choose My Notes? Expertly Written: Each document is crafted with precision and tailored to meet exam requirements. Comprehensive Coverage: No need to look elsewhere; all you need is right here. Proven Success: Countless students have used these notes to secure top marks. Don't miss out on this opportunity to excel. Invest in your success today and experience the difference that quality notes can make. Buy now and take the first step towards guaranteed A grades

Lees meer Lees minder
0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen