sample_term_test_2010_solutions (2)

sample_term_test_2010_solutions (2) - Name:_ Capilano...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Name:_________________________ Capilano University COMP120 Sample Term Test #1 1 hour 20 min. Instructions: No calculators, computers, manuals and notes of any kind are allowed on this test. You are NOT required to write any documentation for your code. Note: Points for each question are given in the section instructions or in brackets by question. Section 1: True/False (10 questions, 1 mark each). Read each question very carefully, and write T for true and F for false by each question. 1. The compiler is a program that takes a program written in a high-level language and translates it into machine code. T 2. When a floating-point value is assigned to an integer variable, the fractional part is truncated (discarded). T 3. An algorithm describes the problem solution step by step, while a computer program solves the problem in one step. F 4. The expression (!((3-4%3)<5 && (6/4 > 3))) is true. T 5. An operating system is the software managing the computer hardware only. F 6. If a while loop's termination condition becomes true in the middle of the loop body, the loop is exited immediately. F 7. In C, the following statements will cause a syntax error. int age = 20; if (age = 30) printf(“age”); F 8. To correct logic errors in our code, we re-execute the program with different input values. F 9. 5.0 /9 evaluates to 0 F 10. The output of the following code float d = 1.2; printf(“Your number is%f.”,d); is: Your number is 1.2. F 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Section 2: Multiple Choice (5 questions, 2 marks each) Read each question very carefully, and circle exactly one choice. 11. Assuming all variables are of type
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/23/2010 for the course PHYSICS 114 taught by Professor Mike during the Spring '10 term at Capilano.

Page1 / 9

sample_term_test_2010_solutions (2) - Name:_ Capilano...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online