1 |
h01 |
CS16 M18 |
Name: | ||||
---|---|---|---|---|
(as it would appear on official course roster) | ||||
Umail address: | @umail.ucsb.edu | |||
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: Computer systems, introduction to C++
ready? | assigned | due | points |
---|---|---|---|
true | Sun 06/24 08:00AM | Tue 07/03 11:00AM |
You may collaborate on this homework with AT MOST one person, an optional "homework buddy".
MAY ONLY BE TURNED IN IN THE LECTURE LISTED ABOVE AS THE DUE DATE,
OR IF APPLICABLE, SUBMITTED ON GRADESCOPE. There is NO MAKEUP for missed assignments;
in place of that, we drop the four lowest scores (if you have zeros, those are the four lowest scores).
Reading: Computer systems, introduction to C++, Chapter 1: pages 2 - 10 and 18 - 27
- (10 pts) Fill in the information in the header. The following are required to get the 10 "participation" points.
- Filling in your name and umail address.
- Also: For paper submission PLEASE submit on ONE SHEET OF PAPER, double-sided if at all possible. If you must submit on two printed sheets write name on BOTH sheets and no staples, paperclips, or folded corners.
- Filling in your name and umail address.
- (10 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:
- (5 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.
- (10 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 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?
- (6 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 variableint age;
has already been declared and initialized with a value, write a C++ statement that will print outMy age is:
followed by the value of the variableage
, followed by a newline. (For full credit, be sure to end your line with a semicolon.) - (5 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.)