Preview

Physics Midterm Exam

Good Essays
Open Document
Open Document
958 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Physics Midterm Exam
____________________________________________________________

_________________________

Spring 2011 CIS115 Introduction to Programming and Logic Midterm Exam
____________________________________________________________

_________________________

ANSWERS

[Please do not share these answers with anybody]

Question 1 to 15: Choose the best answer. Four points for each question.

1. An algorithm is __________.

a) a type of software that analyzes a problem b) a graphical representation of the steps in a program c) a chart that lists input, output and processing items of a program d) a set of step-by-step instructions that is designed to accomplish a task

Correct answer: (d). Answer (b) is flowchart. Answer
…show more content…
The goal of the program is to calculate the weighted total score.

7. The date of birth of the student is

(a) an input item (b) a processing item c) an output item (d) none of the above

Correct answer: (d). The date of birth is not entered nor used in the program. It is irrelevant information.

8. When we create a desk-checking table to test an algorithm, we

(a) create a column for every unique input item only (b) create a column for every unique output item only (c) create a column for every unique input and output item (d) create a column for every unique input, processing and output item

Correct answer: (d)

9. A compiler

(a) checks for syntax errors in your C++ instructions (b) translates your C++ instructions into machine code c) does everything described in (a) and (b) d) does nothing described in (a) and (b)

Correct answer: (c)

10. The following statement is used to declare and initialize a variable in a C++ program:

double height = 0.0;

Which of the following is true?

(a) This statement has a syntax
…show more content…
Suppose a variable g is used to store course grade, which is one of the following letters: A, B, C, D or F. What type should be used for variable g?

(a) int (b) double (c) char (d) var

Correct answer: (c)

12. Which of the following is NOT a valid C++ variable name?

a) sec_test b) secondTest c) second-Test d) None of the names above is invalid

Correct answer: (c). We cannot have “-“ in a variable name

13. Suppose x is an integer variable in a C++ program. Which of the following statements does NOT have a syntax error?

a) x = 4; b) 4 = x; c) x + 2 = 6; d) None of the statements above has syntax error

Correct answer: (a). Answers (b) and (c) have syntax errors because the left hand side of an assignment statement must be a variable name but nothing else.

14. int x = 0; int y = 0; cin >> x; if (x < 10 || x > 20) { y = 6; }

Which of the following statements is true?

a) If the user enters 5 for variable x, then y will equal 6 b) If the user enters 10 for variable x, then y will equal 6 c) If the user enters 15 for variable x, then y will equal

You May Also Find These Documents Helpful

  • Satisfactory Essays

    b. Include the function written in Exercise 2a in a working program. Make sure your function…

    • 720 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    chen (azc96) – Assignment 6 - Electricity – schultz – (WVSPR2011APB01) This print-out should have 20 questions. Multiple-choice questions may continue on the next column or page – find all choices before answering. 001 (part 1 of 2) 10.0 points An object with a charge 3 C and a mass 0.4 kg accelerates from rest to a speed of 19 m/s.…

    • 984 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    d. The words that make up a high-level programming language are known as KEY WORDS or RESERVED WORDS. (pg. 17)…

    • 388 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Nt1310 Unit 3 Quiz

    • 6337 Words
    • 26 Pages

    10 [Ans] Corrected by buddy by running the program Choice 4 11 Choice 5 12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /*question number With every use of release allocated Choice 1 unalloc() Choice 2 dropmem() Choice 3 dealloc() Choice 4 release() Choice 5 free() [Ans] - - - - - - - - 2*/ a memory allocation function, what function should be used to memory which is no longer needed?…

    • 6337 Words
    • 26 Pages
    Good Essays
  • Satisfactory Essays

    Homework Unit 3

    • 354 Words
    • 2 Pages

    1. Statements are execute in order according to the program code. Complex programs can need the help of a decision structure. Statements have to be true to be executed.…

    • 354 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    1.a Up, up, and away [15] A balloonist can’t resist throwing a drink to another balloonist. The ‘thrower’ is moving at v = -15j m/min while the ‘catcher’ is moving at v = 15j m/min. At the instance the former throws the drink the ‘catcher’ is at (3i – 10j) m from the ‘thrower’. If the throw is horizontal, at what speed does the drink need to be thrown to be caught?…

    • 1252 Words
    • 6 Pages
    Powerful Essays
  • Better Essays

    Physics Midterm Study Guide

    • 3632 Words
    • 15 Pages

    The eye of a hurricane passes over New Orleans in a direction 60.0° north of west with a speed of 41.0 km/hr. Three hours later, the hurricane suddenly shifts due north, and its speed slows to 25.0 km/hr. How far from New Orleans is the hurricane 4.50 hours after it passes over the city?…

    • 3632 Words
    • 15 Pages
    Better Essays
  • Satisfactory Essays

    Chapter 18 Physics Lab

    • 343 Words
    • 2 Pages

    Fill out the tables below and check your work in the simulation. ( ½ pt each )…

    • 343 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Mat 540 Week 4 Paper

    • 1775 Words
    • 8 Pages

    * Provide a set of values that will test the normal operation of this program segment. Defend your choices.…

    • 1775 Words
    • 8 Pages
    Powerful Essays
  • Powerful Essays

    Nt1310 Unit 8 Study Guide

    • 546 Words
    • 3 Pages

    13. Writing a program in a language such as C++ or Java is known as _____ the program.…

    • 546 Words
    • 3 Pages
    Powerful Essays
  • Powerful Essays

    c. Click on the computer monitor to view your results and transcribe them to Table 1 below.…

    • 2517 Words
    • 11 Pages
    Powerful Essays
  • Powerful Essays

    Physics Gcse Unit 1 Aqa

    • 2231 Words
    • 9 Pages

    * Can travel through a vacuum, this is how we get energy from the sun…

    • 2231 Words
    • 9 Pages
    Powerful Essays
  • Powerful Essays

    Physics Quiz

    • 934 Words
    • 4 Pages

    2. If you double the current through an inductor, the energy stored in the associated magnetic field increases by a factor of _____.…

    • 934 Words
    • 4 Pages
    Powerful Essays
  • Better Essays

    7) Global variables make debugging difficult because any statement in a program can change its value.…

    • 1580 Words
    • 11 Pages
    Better Essays
  • Better Essays

    Year 11 Physics Assignment

    • 2804 Words
    • 12 Pages

    Task Description:The world communicates by making extensive use of the electromagnetic spectrum. For the average person this is commonly accessed using radio waves. These radio waves may be over the AM or FM radio wave bands or the radio waves that transmit our television signals. Not only are people always within a ‘phone call of each other anywhere in the world they are also able to find out exactly where in the world they are by use of Global Positioning System (GPS) these now hand held devices have many uses within our society.Your TaskPART ATo produce a report based on your Analysis of information to identify the waves involved in the transfer of energy in television signals and draws a flow diagram that describes the energy transformations in television signals as they are transmitted from the studio to your home. Outline how the modulation of amplitude and frequency of radio waves are used to transmit information.PART BLocate and collect a brochure and at least one scientific article that allow you to assess the accuracy and evaluate the validity of scientific information presented in sales brochures of GPS’s in comparison with similar information presented by the scientific community. Use diagrams to help discuss some of the underlying scientific principles related to waves are related to how GPS’s work and identify areas of current research into GPS’s.…

    • 2804 Words
    • 12 Pages
    Better Essays