1
h01
CS16 s20
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 Mon 03/30 11:00AM Sun 04/05 11:59PM

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

MAY ONLY BE TURNED IN IN THE LECTURE/LAB LISTED ABOVE AS THE DUE DATE,
OR IF APPLICABLE, SUBMITTED ON GAUCHOSPACE. There is NO MAKEUP for missed assignments;


Reading: Read Chapter 1, pages 2-7 and 18-27. You don’t need to turn this homework in. To earn credit for this homework, complete the corresponding quiz on gauchospace AFTER you have completed the pen and pencil version of the homework. The quiz will be available at least one day before the due date indicated on the homework.

    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.)