758 Words4 Pages

COMP122
Week 1 Homework
Part 1: Complete the following problems.
1. What is machine code? Why is it preferable to write programs in a high level language such as C++?
Machine code it the language that the computer understands. High level languages are better because they are easier to understand and work with.
2. What does a compiler do? What kinds of errors are reported by a compiler?
A compiler translates one computer language into another. It also pics up errors in the program being put together.
3. What does the linker do?
A linker takes multiple object files, and turns them into an executable program
4. What is an algorithm?
The list of instructions to complete a task on a program
5. Bob enters a pizza shop and notices*…show more content…*

21 % 5 answer: 1 d. 3 - 5 % 7 answer: 3 e. 17.0 / 4 answer: 4 f. 8 - 5 * 2.0 answer: -2 g. 14 + 5 % 2 – 3 answer: 12 h. 15.0 + 3.0 / 2.0 answer: 16.0 2. Given the following variable declarations: int num1 = 10, num2 = 20, newNum = 30; double x = 5.0, y = 8.0; Determine which of the following assignment statements are valid. For each invalid statement, explain why it is invalid. Assume that each statement immediately follows the above variable declarations. a. num1 = 15; b. num2 = num1 - 18; c. num1 = 5; num2 = 2 + 6; num1 = num2 / 3; d. num1 + num2 = newNum; e. x = 12 * num1 - 15.3; f. num1 * 2 = newNum; g. x / y = x * y; h. num2 = num1 % 2.0; i. newNum = static_cast (x) % 5; j. x = x + 5; k. newNum = num1 + static_cast (4.6 / 2); 3. For each of the following lines of variable declarations, identify it as valid or describe what makes the line invalid. Line 1: n = 12; valid Line 2: char letter = ; invalid, don't put “letter” Line 3: int one = 5, two; invalid, “One” and “two” not valid inputs Line 4: double x, y, z; valid 4. Write C++ statements that accomplish each of the following: a. Declare and initialize int variables x to 25 and y to 18. b. Declare and initialize an int variable temp to 10 and a char variable ch to 'A'. c. Add 5 to the int variable x which already exists. d. Declare and initialize a double variable payRate to 12.50. e. Copy the value from an

21 % 5 answer: 1 d. 3 - 5 % 7 answer: 3 e. 17.0 / 4 answer: 4 f. 8 - 5 * 2.0 answer: -2 g. 14 + 5 % 2 – 3 answer: 12 h. 15.0 + 3.0 / 2.0 answer: 16.0 2. Given the following variable declarations: int num1 = 10, num2 = 20, newNum = 30; double x = 5.0, y = 8.0; Determine which of the following assignment statements are valid. For each invalid statement, explain why it is invalid. Assume that each statement immediately follows the above variable declarations. a. num1 = 15; b. num2 = num1 - 18; c. num1 = 5; num2 = 2 + 6; num1 = num2 / 3; d. num1 + num2 = newNum; e. x = 12 * num1 - 15.3; f. num1 * 2 = newNum; g. x / y = x * y; h. num2 = num1 % 2.0; i. newNum = static_cast (x) % 5; j. x = x + 5; k. newNum = num1 + static_cast (4.6 / 2); 3. For each of the following lines of variable declarations, identify it as valid or describe what makes the line invalid. Line 1: n = 12; valid Line 2: char letter = ; invalid, don't put “letter” Line 3: int one = 5, two; invalid, “One” and “two” not valid inputs Line 4: double x, y, z; valid 4. Write C++ statements that accomplish each of the following: a. Declare and initialize int variables x to 25 and y to 18. b. Declare and initialize an int variable temp to 10 and a char variable ch to 'A'. c. Add 5 to the int variable x which already exists. d. Declare and initialize a double variable payRate to 12.50. e. Copy the value from an

Related

## Week 2 Fin515 Homework

1102 Words | 5 Pagesdaily sales are $20,000. What is the level of its accounts receivable? Assume there are 365 days in a year. Formula for DSO = Receivables/ Ave sales per day = Receivables/( Annual sales/365) = 20 days x $20,000= $400,000 Solution: AR = $400,000 3-2 Debt Ratio Vigo Vacations has an equity multiplier of 2.5. The company’s assets are financed with some combination of long-term debt and common equity. What is the company’s debt ratio? Formula for Debt ratio = Debt Ratio + Equity Ratio = 1 Equity

## fin 516 homework week 2 Essay

2011 Words | 9 Pageslong-term loan at 9.10% + 0.50%=9.60%. Unwind swap by entering new swap to pay LIBOR and receive 9.50%. Effective borrowing cost now: • 9.60% + (-LIBOR + 8.0%) + (LIBOR – 9.50%) = 8.10% • The rate is equal to the original long-term rate, less the 2% decline in the firm’s credit spread. Problem 30-6 on Futures Contract based on Chapter 30 (Excel file included) Your utility company will need to buy 100,000 barrels of oil in 10 days, and it is worried about fuel costs. Suppose you

## Good Performances In Bulimia-Idaho

1043 Words | 5 Pagesonline courses. One of these characteristics is the different academic development from online students like homework, quizzes, and tests. In fact, in the last years there have many assumptions from different professionals that a good performance in homework will cause or will be related to good performances in quizzes and tests. The purpose of this paper is to show that good performances in homework

## Elementary Algebra and Study Plan

2894 Words | 12 Pagesequations. Read Ch. 2, sections 2.1–2.3 of Beginning and Intermediate Algebra. Participate in class discussion. Ongoing – At least 2 posts on 4 Separate Days. Class participation posts require a minimum of 75 words. Respond to weekly discussion questions. Discussion Question 1 Discussion Question 2 Watch this week’s videos located on your student website. Day 2 Day 4 10 Due Points Reading Participation Discussion Questions Nongraded Activities and Preparation Week Two Videos Individual

## The Curiosity Project

359 Words | 2 PagesAppendix A for weekly homework assignments). Over the course of five weeks students will be given a weekly homework packet for science. The packet will include two tasks and instructions for both the parents and the student participants. The packet will be introduced on Monday and the teacher will provide an explanation in class about what to do this week. Students will have the entire week to complete the packet. Homework will be checked weekly on Fridays. Depending on the week, students will present

## Ashford Mgt 330 Entire Course (Management for Organizations)

1371 Words | 6 Pageshttp://homework-aid.com/ASHFORD-MGT-330-Entire-Course-Management-for-Organizations-944.htm?categoryId=-1 MGT 330 Week 1 DQ 1 Surf Shop Comparison MGT 330 Week 1 DQ 2 Company Evaluation MGT 330 Week 2 Case Study Starbucks’ Structure MGT 330 Week 2 DQ1 Structure for Conglomerates MGT 330 Week 2 DQ2 Classifying Structure MGT 330 Week 3 DQ 1 Legal Aspects of Staffing MGT 330 Week 3 DQ 2 Bias in Performance Appraisal MGT 330 Week 4 DQ 1 Theories of Motivation MGT 330 Week 4 DQ 2 Productivity

## Engl 216 Entire Course Guide Week 1 - 8

2460 Words | 10 PagesCourse Guide Week 1 - 8 Purchase here http://devrycourse.com/ENGL%20216/engl-216-entire-course-guide-week-1-8 Product Description ENGL 216 Week 1 Homework Assignment ENGL 216 Week 1 Discussion Question 1 ENGL 216 Week 1 Discussion Question 2 ENGL 216 Week 2 Homework, A Proposal to the Student Council ENGL 216 Week 2 Course Project; Course Project Launch & Topic ENGL 216 Week 2 Discussion Question 1 ENGL 216 Week 2 Discussion Question 2 ENGL 216 Week 3 Homework Assigment; Memorandum

## Mat 510 Mat510 Week 8 Case Study 2: Improving E-Mail Marketing Response

683 Words | 3 PagesMAT 510 MAT510 Week 8 Discussion http://workbank247.com/q/mat-510-mat510-week-8-homework-case-study-discussi/20075 http://workbank247.com/q/mat-510-mat510-week-8-homework-case-study-discussi/20075 Select one (1) project from your working or educational environment that you would apply the DOE technique for the work process. Next, analyze the overall manner in which you would utilize DOE to manage and improve the work process of the project in question. Provide a rationale for your response

## Week 3 Aib Problem Solutions

726 Words | 3 PagesAIB Homework Problem Solutions Problem 1 The following data were obtained from a project to create a new portable electronic. Activity A B C D E F G H I Duration 5 Days 6 Days 8 Days 4 Days 3 Days 5 Days 5 Days 9 Days 12 Days Predecessors ------A, B C D E, F D G Step 1: Construct a network diagram for the project. (NOTE: EF for activity H should be 19) March 2014 1 AIB Homework Problem Solutions Step 2: Answer the following questions: (15 points total)

## Acc 556 Complete Discussion Acc556 Acc 556 Complete Course Week 1 to Week 11

2045 Words | 9 PagesACC556 ACC 556 Complete Course Week 1 to Week 11 Download Answer here http://workbank247.com/q/acc556-acc-556-complete-course-week-1-to-week-11/12254 http://workbank247.com/q/acc556-acc-556-complete-course-week-1-to-week-11/12254 http://workbank247.com/q/acc556-acc-556-complete-course-week-1-to-week-11/12254 ACC 556 Complete Discussion ACC 556 Week 1 Discussion "Financial Statements" Please respond to the following: * From the e-Activity, analyze Apple’s most recent financial statements

### Week 2 Fin515 Homework

1102 Words | 5 Pages### fin 516 homework week 2 Essay

2011 Words | 9 Pages### Good Performances In Bulimia-Idaho

1043 Words | 5 Pages### Elementary Algebra and Study Plan

2894 Words | 12 Pages### The Curiosity Project

359 Words | 2 Pages### Ashford Mgt 330 Entire Course (Management for Organizations)

1371 Words | 6 Pages### Engl 216 Entire Course Guide Week 1 - 8

2460 Words | 10 Pages### Mat 510 Mat510 Week 8 Case Study 2: Improving E-Mail Marketing Response

683 Words | 3 Pages### Week 3 Aib Problem Solutions

726 Words | 3 Pages### Acc 556 Complete Discussion Acc556 Acc 556 Complete Course Week 1 to Week 11

2045 Words | 9 Pages