practice1key[1] - 1[9 points Give 3 reasons why it's...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 Practice Exam 1 PIC 10A Disclaimer: Your real exam will be similar to this practice exam in spirit, but of course the questions will not be few weeks, so all topics are not represented on this practice exam. But they're still fair game for Monday's exam. To cover more ground, this practice exam is longer than Monday's exam will be. The exam covers Sec 1.1-4.7 in your book. You have 50 minutes to complete this exam. You are not allowed to use any books, notes, calculators, or electronic devices. Write your answers carefully. Incomplete, unintelligible, or illegible answers will receive little or no credit. When you are asked to write a program, it is not necessary to comment your code. There are a total of 100 points on this exam.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1.) [9 points] Give 3 reasons why it's important to comment your code. What are the 2 different ways to comment code in C++ and how are they different? It's important to comment your code because. .. 1. it makes easier for other people to understand your program. 2. it helps you while programming to organize and write your code. 3. it helps you track down and debug errors. The // comment style comments out any text on that line to the right of the slashes. The /* */ comment style comments out all code contained between the asterisks. 2.) [6 points] Write the output of the following segments of code. a.) int x = 3 cout << x << 2*x 36 b.) cout << "\"Hello\\\n Gandalf!" exactly the same. Wehve covered many topics in the last...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online