Programming Chapter 3 Review Questions
15 Questions
100 Views

Programming Chapter 3 Review Questions

Created by
@AmicableNeodymium

Questions and Answers

What is wrong with the following instructions: Prompt for starting Odometer Reading, Get starting Odometer Reading, Prompt for ending Odometer Reading, Get ending Odometer Reading, Display distance Traveled?

The instructions are not correctly ordered.

What is wrong with the following instructions: Face the audience, Place your left leg forward, Hold out your right hand over your head, Extend your hand out from your shoulder?

The instructions are ambiguous.

In programming, instructions that are not understandable because they do not use the language correctly are said to contain what?

Syntax errors.

In programming, instructions that are understandable but not correct are said to contain what?

<p>Logical errors.</p> Signup and view all the answers

Which question needs to be more specific in order to answer it correctly: Can you tell me how to get to the store?

<p>The question is too general.</p> Signup and view all the answers

What is wrong with the following instructions: Take your rental car key to the parking lot, Try all the cars until you find the car it fits—that's your rental car?

<p>The instructions are not efficient.</p> Signup and view all the answers

What is an algorithm?

<p>A set of clearly written, unambiguous instructions to perform a task.</p> Signup and view all the answers

What is pseudocode?

<p>Instructions that combine English with the structure and syntax of programming languages.</p> Signup and view all the answers

What is a selection statement?

<p>Instructions that provide a choice between two or more actions.</p> Signup and view all the answers

How many assignment operations do you see in this algorithm: age = 20, yearsToRetire = 65 - age, Display yearsToRetire?

<p>2</p> Signup and view all the answers

How many different variables do you see in this algorithm: age = 20, yearsToRetire = 65 - age, Display yearsToRetire?

<p>2</p> Signup and view all the answers

What will be displayed if the algorithm is executed: age = 20, yearsToRetire = 65 - age, Display yearsToRetire?

<p>45</p> Signup and view all the answers

Which variable name is an example of camelback notation?

<p>salesCommission</p> Signup and view all the answers

What type of operation is used to store a value in a variable?

<p>Assignment operation.</p> Signup and view all the answers

What type of operation is used to compare two values?

<p>Logical operation.</p> Signup and view all the answers

Study Notes

Programming Instructions and Errors

  • Proper sequencing of instructions is essential for clarity and effectiveness in programming tasks.
  • Ambiguous instructions can lead to confusion and incorrect execution during tasks.
  • Syntax errors occur when programming instructions are not formulated correctly within the language rules.

Logical Errors and Algorithm Understanding

  • Logical errors arise when instructions are syntactically correct but produce unintended outcomes.
  • Algorithms consist of clear, unambiguous instructions necessary for performing tasks efficiently.

Pseudocode and Selection Statements

  • Pseudocode blends English with programming structures to represent algorithms in a simplified manner.
  • Selection statements allow for decision-making, providing choices between multiple actions in algorithms.

Variables and Assignment Operations

  • Assignment operations are used to assign values to variables, crucial for data manipulation in algorithms.
  • The example algorithm demonstrates two assignment operations and a total of two variables involved.

Output of Algorithms

  • Executing the provided algorithm results in the display of the computed value, in this case, 45 years until retirement.
  • Camelback notation is a popular variable naming convention, as exemplified by the variable name "salesComission."

Efficiency and Specificity in Instructions

  • Instructions should be efficient to prevent unnecessary actions, such as trying all cars when locating a rental.
  • Questions aimed for answers must be specific to elicit clear and useful responses.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Test your understanding of Chapter 3 with these flashcards. Each card provides instructions to evaluate and identify what is wrong, helping you solidify your knowledge of programming concepts and practices.

More Quizzes Like This

Computer Systems Quiz
10 questions

Computer Systems Quiz

SumptuousTortoise avatar
SumptuousTortoise
Control Instructions in Programming
18 questions
Computer Programming Instructions
10 questions
Use Quizgecko on...
Browser
Browser