Pt1420

In: Computers and Technology

Submitted By suros10
Words 764
Pages 4
PT1420
7/12/14

Short answer:

5. What two things must you normally specify in a variable declaration? a. Variable type b. Identifier

6. What value is stored in uninitialized variables?

Some languages assign a default value as 0 to uninitialized variables. In many languages, uninitialized variables hold unknown values.

Algorithm Workbench:

3. Write assignment statements that perform the following operations with the variables a, b, and c. a. Adds 2 to a and stores the result in b. b. Multiplies b times 4 and stores the result in a c. Divides a by 3.14 and stores the result in b d. Subtracts 8 from b and stores the result in a

a. Adds 2 to a and stores the result in b. Set b = 2 + a b. Multiplies b times 4 and stores the result in a set a. Set a = b * 4 c. Divides a by 3.14 and stores the result in b. Set b = 3.14 / b d. Subtracts 8 from b and stored the result in a. Set a = b - 8

4. Assume the variables result, w, x, y and z are all integers, and that w = 5, x = 4, y = 8, and z = 2. What value will be stored in result in each of the following statements?

a. Set result = x + y (4 + 8) = 12 b. Set result = z * 2 (2 * 2) = 4 c. Set result = y / x (8 / 4) = 2 d. Set result = y – z (8 – 2) = 6

5. Write a pseudocode statement that declares the variable cost so it can hold real numbers.

Dim cost1 As Double = 0

6. Write a pseudocode statement that declares the variable total so it can hold integers. Initialize the variable with the value 0.

Dim cost1 As Integer = 0
7. Write a pseudocode statement that assigns the value 27 to the variable count.

Dim count As Integer = 27

8. Write a pseudocode statement that assigns the sum of 10 and 14 to the variable total.

Total = 10 + 14

9. Write a pseudocode statement that subtracts the variable downPayment from the…...

Similar Documents

Pt1420

...ALONZO DARGAN (17186943) PT1420 Computer Programming Unit 7 Assignment 1: Homework 7 May 2014 Short Answers Page 213 1-5 1. Why should you indent the statements in the body of a loop? Because by indenting the statements in the body of the loop you visually set them apart from the surrounding code. This makes your program easier to read and debug. 2. Describe the difference between pretest loops and posttest loops. A pretest loop means to test its condition before performing an iteration A posttest loop means it performs an iteration before testing its condition. 3. What is a condition-controlled loop? A condition-controlled loop uses a true/false condition to control the number of times that it repeats. 4. What is a count-controlled loop? A count-controlled loop repeats a specific number of times. 5. What three actions do count-controlled loops typically perform using the counter variable? 1) Initialization: the variable is initialized 2) Test: the loop tests the variable by comparing it to the maximum value 3) Increment: to increase the value during each iteration the loop increments the counter variable by adding 1 to it. Algorithm Workbench Review Questions 1,2,7, and 8 p. 213-214 1. Design a While loop that lets the user enter a number. The number should be multiplied by 10, and the result stored in a variable named product. The loop should iterate as long as the product contains a value less than 100. A- Declare number as integer ...

Words: 721 - Pages: 3

Pt1420

...PT1420 unit 1 homework 1. Software mainly directs and coordinates computer hardware. In its function, software directly provides instructions to the computer hardware and serves as input to another piece of software to facilitate computing. 2. Some basic computer hardware includes the motherboard, CPU, RAM, hard drive. 3. A computer stores data in clusters on the hard drive. Each cluster is a pie slice-looking area that holds a certain amount of data. The amount of data that can be stored in each cluster is dependent on the operating system. 4. A program tells the computer how to accept some type of input, manipulate that input, and spit it back out again in some form that humans find useful. 5. Machine Language is what essentially people normally call binary. Assembly Language is the next step up, using specific keywords and terms, and will require an assembler to convert into executable machine language. A high-level language is what most programmers’ use, because of its reconizability since it may contain some English terms that we humans can understand. To convert a high-level language to machine language, you'll need a compiler and linker. 6. A compiler takes all of the code and translates it into something a computer can understand. This compiled code is then executed or saved to a file to be executed at a later time. Interpreter takes code and translates it line by line and doesn't save the translated code in a file. 7. System......

Words: 418 - Pages: 2

Pt1420

...PT1420 - Midterm Study Guide Study online at quizlet.com/_cl08u 1. ...: How many times will this loop iterate Set = 1 While i 5 Display i end while 22. List three examples of application software: Microsoft Word Adobe Photoshop Microsoft Visual Studio 6. ...: How many times will this loop iterate Set = 1 While i Great Then < Less Then >= Greater Then or Equal 7 is false 5 < 7 Is True (5 > 7) or (10 > 3) is True (5 > 7) and (10 < 3) is False NOT (5 > 7 ) and (10 > 3 )is true because the NOT reverses the False Age < 10 and age > 60 Will never be true 55. What is the term that describes the part of the program that a variable can be accessed?: Scope What is the truth table for AND?: True AND True = True True AND False = False False AND False = False False AND True = False 34. 35. 56. 36. 57. What is the truth table for OR?: True OR True = True True OR False = True False OR False = False False OR True = True 58. 59. 60. What is the value of 2^3?: 2 2 2 = 8 What is the value of 4^2?: 4 * 4 = 16 What is the value of the expression 10-4*3/2+5?: 9. Multiply first, then divide, then subtract and finally add. What is used to check the relationship between two values?: Relational Operator What is used to translate high level language programs to machine language (or machine code)?: Compiler What makes a computer useful for everyday tasks?: Application Software What was the first programming language designed to perform complex math functions?:...

Words: 779 - Pages: 4

Pt1420 Unit 10

...PT1420 Unit 10 Assignment Homework True or False 1. When working with a sequential access file, you can jump directly to any piece of data in the file without reading the data that comes before it. False 2. In most languages, when you open an output file and that file already exists on the disk, the contents of the existing file will be erased. True 4. The purpose of an EOF marker is to indicate where a field ends. Files typically contain several EOF markers. False 5. When an input file is opened, its read position is initially set to the first item in the file. True Algorithm Workbench 1. Design a program that opens an output file with the external name my_ name. dat, writes your name to the file, and then closes the file. Declare an internal name for an output file. 2 Declare OutputFile myFile 3 4 // Declare the variable to hold values 5 // that will be read from the file 6 Declare String name 7 8 // Open a file named my_name.dat on 9 // the disk 10 Open myFile “my_name.dat” 11 12 // Write your name to the file 13 Write myFile “Your Name” 14 15 // Close the file 16 Close myFile 2. Design a program that opens the my_ name. dat file that was created by the algo-rithm in question 1, reads your name from the file, displays the name on the screen, and then closes the file. Declare InputFile myName Declare String name Open myName "my_Name.dat" Display "Your name is: " While NOT eof (myName) Read myName name Display......

Words: 607 - Pages: 3

Pt1420 Unit 2 Research

...PT1420 Unit 2 Research Variable names should be short yet meaningful. The choice of a variable name should be mnemonic — that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary "throwaway" variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters. Local variables, instance variables, and class variables are also written in lower Camel Case. Variable names should not start with underscore (_) or dollar sign ($) characters, even though both are allowed. In Java, naming conventions for identifiers have been established and suggested by various Java communities such as Sun Microsystems, Netscape, AmbySoft etc. The Classes names should be nouns in upper camel case, with the first letter of every word capitalized. Use whole words — avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML). Methods should be verbs in lower camel case; that is, with the first letter lowercase and the first letters of subsequent words in uppercase. Certain coding conventions state that underscores should be used to prefix all instance variables, for improved reading and program understanding. Constants should be written in uppercase characters separated by underscores. Constant names may also contain digits if appropriate, but not as the first character. In Python its recommend to......

Words: 291 - Pages: 2

Unit 1 Pt1420

...Unit 1 Research 1 PT1420 In the 1970s the programming language that was most popular was Pascal. Pascal was designed in 1968-69 but published in 1970. Niklaus Wirth created the Pascal language to “1) make available a language suitable for teaching programming as a systematic discipline based on fundamental concepts clearly by the language, and 2) to define a language whose implementations could be both reliable and efficient on then-available computers. In 1972 the C programming language was developed by Dennis Ritchie. C was created to work with the system Unix. “Unix gives C such advanced features as dynamic variables, multitasking, interrupt handling, forking, and strong, low-level, input-output. Because of this, C is very commonly used to program operating systems such as Unix, Windows, the MacOS, and Linux.” In the 1980s the popular programming language was C++. C++ was developed at Bell Laboratories. C++ is a general purpose multi-paradigm spanning compiled language that has both high-level and low-level languages’ features. It was started as an enhancement to the C programming language, Bjarne Stroustrup in 1979. In the 1990s Java was the popular programming language. It was created in 1991 developed by James Gosling at Sun Microsystems and release in 1995. In the 2000s Visual Basic (VB) was popular in the programming world. VB was developed from BASIC which was originally developed in 1964 by John Kemeny and Thomas Kurts. VB is a Microsoft programing language and......

Words: 261 - Pages: 2

Pt1420 Short Answer

...PT1420 Unit 5 Assignment 1 : Home Work John Broussard 1. Explain what is meant by the term “conditionally executed”. Conditionally executed is called a single alternative decision structure because it provides only one alternative path of execution. The action is conditionally executed because it is performed only when a certain condition is true. 2. You need to test a condition and then execute one set of statements if the condition is true. If the condition is false, you need to execute a different set of statements. What structure will you use? I will use the “If” statement because it is a dual alternative decision structure. 3. If you need to a test the value of a variable and use that value to determine which statement or set of statements to execute, which structure would be the most straightforward to use? The case structure lets the value of a variable or an expression determine which path of execution the program will take. 4. Briefly describe how the AND operator works. The AND operator takes two Boolean expressions as operands and creates a compound Boolean expression that is True only when both sub-expressions are true. 5. Briefly describe how the OR operator works. The OR operator takes two Boolean expressions as operands and creates a compound Boolean expression that is true when either of the sub-expressions is true. The following is an example of an If-Then statement that uses the OR operator: 6.When......

Words: 336 - Pages: 2

Pt1420 Unit 1

...“Unit 1 Assignment 1” ITT Technical Institute Intro to Programming – PT1420 Unit 1 Assignment 1 Short Answer Questions 1. Why is the CPU the most important component in a computer? The reason the CPU is the most important component in a computer is because without the CPU you can’t run any software. 2. What number does a bit that is turned on represent? What number does a bit that is turned off represent? The number in a bit that represents a turned on position is 1. The number in a bit that represents a turned off position is 0. 3. What would call a device that works with binary data? A digital device is a device that works with binary data. 4. What are the words that make up a high-level programming language called? Keywords or Reserved Words are words that make up a high-level programming language. 5. What are short words that are used in assembly language called? Mnemonics are short words that are used in assembly language. 6. What is the difference between a compiler and an interpreter? The difference between a compiler and an interpreter is that a compiler translates high-level language into separate machine language program while an interpreter translates AND executes the instructions in a high-level language program. 7. What type of software controls the internal operations of the computer’s hardware? An operating system controls the internal operations of the computer’s hardware. Unit 1 Research Assignment 1 * What......

Words: 1534 - Pages: 7

Pt1420 Homework

...PT1420 Melson, Brain Unit 4 Assignment 1: Homework Learning Objectives and Outcomes * Explain the importance of separating code into modules for efficiency. * Use flowcharts and pseudocode to represent program modules. * Describe the impact of program modules on variables—variable scope. * Describe the necessity of having compatible arguments in module parameters. * Evaluate the various program modules. Assignment Requirements Do the following problems: * Short Answer 1-7 on page 111 1. How do modules help you to reuse code in a program? a. Help reduce the duplication of code within a program, this benefit of using modules is known as code reuse because you are writing the code to perform a task once and then reuse it each time you need to perform a task. 2. Name and describe the two parts that a module definition has in most languages. a. A header and a body. The header indicates the starting point of the module, and the body is a list of statements that belong to the module. 3. When a module is executing, what happens when the end of the module is reached? a. When a module is called, the computer jumps to that module and executes the statement in the module's body. Then, when the end of the module is reached, the computer jumps back to the part of the program that called the module, and the program resumes execution at that point. 4. What is a local variable? What statements are able to access a local variable? ...

Words: 1156 - Pages: 5

Pt1420 Unit 2 Research

...Kelli Okuly PT1420 Unit 2 Research Assignment 12-5-2014 Variable naming conventions vary from program to program. In Visual Basic the variable must begin with a letter and you cannot use a space, period (.), or the characters !, @, &, $, # in the name. Visual Basic variable names must be under 255 characters long. You shouldn't use any names that are the same as the functions, statements, and methods in Visual Basic. You end up shadowing the same keywords in the language. To use a basic language function, statement, or method that conflicts with an assigned name, you must explicitly identify it. Precede the fundamental function, statement, or method name with the name of the associated type library. For example, if you have a variable called “Left”, you can only use the “Left” function using “VBA.Left”. In Python, variables must begin with a letter or underscore (_). Other characters can be letters, numbers, or the underscore. Python variables are case sensitive and can be any length, within reason. There are several keywords in Python that are reserved for other functions and cannot be used as variables. For example; print, def, from, not, and return. Variables in Java are referred to as Identifiers. In Java the variable must begin with a letter, an underscore, or a dollar sign ($) although a letter is typically what is used. The other characters may be letters or numbers, no spaces or special characters are allowed. Java identifiers can be any length......

Words: 405 - Pages: 2

Pt1420 Programming

...PT1420 - Unit 3 Homework and Lab Assignment Unit 3 Assignment 1: Homework 1.) A dietician wants you to write a program that will calculate the number of calories a person can lose by walking at a slow pace for a mile; however, the user will have only the distance given by a pedometer, which is measured in steps and not miles. Assume each mile a person walks is equivalent to 2000 steps, and that for every mile walked, a person loses 65 calories. Allow the user of the program to enter the number of steps taken throughout the day. The program will calculate the distance in miles and the number of calories lost. The user of the program should also be able to enter the day of the week the data is being calculated for. The day of the week, the distance in miles, and the calories lost should then be displayed to the screen. Using the Input, Process, Output program cycle, list the elements to be included in each step of the cycle, based on the program requirements above. Paste your answers here Miles walked Day of the week Process # of steps/2000 Process answer above *65 calories Output day of the week, miles walked and calories lost 2.) Design a program that converts Celsius temperatures to Fahrenheit temperatures. You can approach this using either pseudocode or a flowchart, or both. Paste your design here. ***************************************************************** Unit 3 Labs Problem: Write a program that will take in basic......

Words: 493 - Pages: 2

Unit 10 Homework Pt1420

...Unit 10 Assignment Homework PT1420 Intro to Programming True or False 1. When working with a sequential access file, you can jump directly to any piece of data in the file without reading the data that comes before it. False 2. In most languages, when you open an output file and that file already exists on the disk, the contents of the existing file will be erased. True 4. The purpose of an EOF marker is to indicate where a field ends. Files typically contain several EOF markers. False 5. When an input file is opened, its read position is initially set to the first item in the file. True Algorithm Workbench 1. Design a program that opens an output file with the external name my_ name. dat, writes your name to the file, and then closes the file. Declare an internal name for an output file. 2 Declare OutputFile myFile 3 4 // Declare the variable to hold values 5 // that will be read from the file 6 Declare String name 7 8 // Open a file named my_name.dat on 9 // the disk 10 Open myFile “my_name.dat” 11 12 // Write your name to the file 13 Write myFile “Your Name” 14 15 // Close the file 16 Close myFile 2. Design a program that opens the my_ name. dat file that was created by the algo-rithm in question 1, reads your name from the file, displays the name on the screen, and then closes the file. Declare InputFile myName Declare String name Open myName "my_Name.dat" Display "Your name is: " While NOT eof (myName) Read......

Words: 610 - Pages: 3

Pt1420 1

...Bradley Griffin Keith Warren PT1420 Unit 2 Assignment 1: Homework Short Answer: 1. If the problem is program assignment of some sort, than the first step would be to design the basis of the program in pseudocode to gain a clear picture of what kind of commands will work where, then move into flowcharting to start putting together the logic. b. If the problem is an issue in the code that is preventing it from executing, than the first thing that should be done is to look over the program for syntax errors and logic errors.  2. Pseudocode is fake code. This is where a programmer writes out the code without worry of syntax or logic errors to get a visual feel of how the program should unfold. 3. Input, Process, and Output 4. User-Friendly is a term used to describe programs that are easy to use. Algorithm Workbench: 1. A. Display “Height” B. Input height C. Display “Here is the height you entered:”, height 2. A. Display “Favorite Color” B. Input Favorite Color C. Display “Here is your favorite color you entered:”, color Programming Exercises: 1. Personal Information 1 Display “Name” 2 Input Name 3 Display “Here is the name you have entered:”, name 4 Display “Address with city, state, and ZIP” 5 Input address with city, state, and ZIP 6 Display “This is the address you have entered:”, address with city, state, and ZIP 7 Display “Telephone number” 8 Input telephone number 9 Display “This is the telephone number you have entered:”,......

Words: 277 - Pages: 2

Pt1420 Lab 6

...Elizabeth Thomas PT1420 Lab 6 February 1, 2016 Lab 6.1 Declare Integer mobileProvider = 0 Declare Integer dataOption = 0 Declare Boolean dataPackage = True Module inputOptions (Ref Integer mobileProvider, Ref Integer dataOption, Ref Boolean dataPackage) Display “Enter 1 for ATT, 2 for Sprint, and 3 for Verizon” Input mobileProvider Display “Enter 1 if you want a data package, or 2 if you do not.” Input dataOption If dataOption ==1 Then Display “True” Else Display “False” End if End Module Module displayProvider(Ref Integer mobileProvider) Select displayProvider Case 1: Display “You selected ATT.” Case 2: Display “You selected Sprint.” Case 3: Display “You selected Verizon.” Case 4: Display “You did not enter a valid option.” End Module Get mobileProvider (1== ATT, 2== Sprint, 3== Verizon) Get dataOption (1== data package, 2== no data package Get dataPackage (True OR False) If mobileProvider== 1 AND If dataPackage== True THEN Display (“You have selected ATT with a data package”) Else If mobileProvider== 2 OR If dataPackage== True THEN Display (“You have selected Sprint or you have selected with a data package.”) Else If mobileProvider== 3 AND If dataPackage== False THEN Display (“You have selected Verizon and no data package.”) End If 6.2 Module Module1 Sub Main() Dim mobileProvider As Integer = 0 Dim dataOption As Integer = 0 Dim dataPackage As Boolean = True ...

Words: 429 - Pages: 2

Unit 6 Pt1420 Introprogramming

...Delvon Frye 7/26/2016 PT1420 Unit 6 Assignment Algorithm Workbench pg. 159 6-10 6. Select number Case 1: Display “You selected A.” Case 2: Display “You selected 2.” Case 3: Display “You selected 3.” Case 4: Display “You selected 4.” Default: Display “Not good with numbers, eh?” End Select 7. If Speed 24 > and Speed < 56 Display “Speed is normal.” Else Display “Speed is abnormal.” 8. If points are < 9 and >51 Display “Invalid points.” Else 9. Display “Valid points.” Select testMonth Case value_1: Display “January has 31 days.” Case value_2: Display “February has 28 days.” Case value_3: Display “March has 31 days.” Default: Display “Invalid selection.” End select 10. If hours==10 THEN Programming Exercises 5 and 8 pg. 160 5. Dim color1 as string Dim color2 as string Display (“Please enter two primary colors.”) Display (“The color you made is Purple”) Else Display (“The color you made is Purple”) Else Display (“The color you made is Orange”) Else Display (“The color you made is Orange”) Else Display (“The color you made is Green”) Else Display (“The color you made is Green”) Else If color1 = else or color2 = else then Display (“You failed to enter a valid color!”) End if 8. //This is a program asks the user to enter the number of coins required to make exactly one dollar. //Declare the variables Declare Real pennies Declare Real nickels Declare Real dimes......

Words: 533 - Pages: 3

Cultural perspective | Anatomical Terms Of Motion | Read more