1
h01
CS16 F19
Name:
(as it would appear on official course roster)
Umail address: @umail.ucsb.edu section
Optional: name you wish to be called
if different from name above.
Optional: name of "homework buddy"
(leaving this blank signifies "I worked alone"

h01: Chapter 1: Computer systems, introduction to C++

ready? assigned due points
true Thu 09/26 12:30PM Thu 10/10 12:30PM

You may collaborate on this homework with AT MOST one person, an optional "homework buddy".

UPLOAD A PDF OF YOUR ANSWERS TO GRADESCOPE BEFORE THE DUE DATE. ASSOCIATE EACH QUESTION WITH A SPECIFIC PAGE IN YOUR HOMEWORK AT THE TIME OF SUBMISSION. There is NO MAKEUP for missed assignments;


Reading: Read Chapter 1, pages 2-7 and 18-27, course syllabus and policies. Turn your homework in during lecture.

    1. (4 pts) Before you come to your first discussion section (lab), PLEASE visit this website and create your College of Engineering account (unless you already have one). Then write your College of Engineering username below. (DO NOT WRITE YOUR PASSWORD!!!!! NEVER WRITE DOWN YOUR PASSWORD!!! Just your username!) Website: https://accounts.engr.ucsb.edu/create. Write your username here:
    2. (1 pt) What is the size of the smallest data item in main memory that has a memory address? You may provide your answer in bits or bytes.
    3. (5 pts) The book talks about the five important hardware components of a computer i) input devices ii) output devices iii) processor iv) main memory and v) secondary memory. It also talks about two important pieces of software: compilers and operating systems. Which of the above is primarily responsible for each of the following tasks? Write 'none' if none of the options apply.
    i. Converts a program from a high-level language to machine language.
    ii. Executes a program stored in main memory.
    iii. Allocates the computer's resources to the different tasks that the computer must accomplish.
    iv. Stores a program while it is being executed.
    v. Converts a program from one high-level language to another high-level language.
    4. (2 pts) Not including any comments that may appear, what are the first two lines that typically begin a C++ program that is going to either output on the screen, and/or read input from the keyboard?
    5. (4 pts) As you discovered when you read the textbook, for the most basic kind of input and output, C++ uses two words, and two symbols, along with variables and quoted strings. Unlike in some other languages (e.g. Python), quoted strings must always use double quote marks "like this", never single quotes 'like this'. (Single quotes are used for another purpose in C++.) Inside a quoted string, \n means “newline”. Quoted strings can only be output, while the value of a variable can be either output to the screen, or read in from the keyboard. Variable names are not put inside quotation marks. Also remember that every line of C++ that does input or output must end in a semicolon.
    Assuming the variable int age; has already been declared and initialized with a value, write a C++ statement that will print out My age is: followed by the value of the variable age, followed by a newline?. (For full credit, be sure to end your line with a semicolon.)
    6. (4 pts) The textbook describes C++11 on p.27. Briefly, what is C++11? (A one sentence answer is good enough. Note that if your textbook doesn't describe C++11 on p. 27, then you may have the wrong edition. You need the ninth or tenth edition.)
    7. (5 pts) Read each of the following scenarios related to students A and B who have collaborated on completing one of the programming assignments in CS16. The lab asks students to implement four functions in C++ and optionally allows students to program in pairs. For each one, state whether it violates academic honesty and collaboration policy for CS16.
    i. The students decide to split the work. They individually implement two functions each, later combine their implementations into a single file and submit to gradescope.
    ii. The students first try to complete the lab individually. However, half way through realize that its too hard and decide to pair up after that.
    iii. The students decide to pair on the assignment before they attempt to solve it. They sit together on a single terminal, with one student typing (in the role of the driver) and another watching over the code to provide helpful suggestions (in the role of the navigator). The two students communicate frequently to make sure they both agree on a solution strategy. After sometime, they switch roles, so that each student gets the chance to type. When submitting to gradescope (the autograder for this class), they make copies of their joint solution and submit it individually.
    iv. Same situation as part (iii), except students additionally include the name of both partners in each file and submit to gradescope. They however, do not add their partner's name on the gradescope submission.
    v. Same situtation as part (iii), except students additionally include the name of both partners in each file and submit to gradescope. They add the name of both partners in gradescope on their (single) joint submission.