📄 http:^^www.cs.wisc.edu^~milo^cs302^quiz2.html
字号:
Date: Mon, 11 Nov 1996 17:12:36 GMTServer: NCSA/1.5Content-type: text/htmlLast-modified: Fri, 04 Oct 1996 07:14:26 GMTContent-length: 2279<HTML><HEAD><TITLE>Quiz 2 - CS 302 Fall 1996 - Section 4</TITLE></HEAD><BODY><H5 ALIGN=RIGHT>Name: _______________________________ </H5><H4 ALIGN=CENTER> <!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><A HREF="http://www.cs.wisc.edu/~cs302">CS 302</A> Fall 1996 - <!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><A HREF="http://www.cs.wisc.edu/~milo/cs302.html">Section 4</A></H4> <H4 ALIGN=CENTER>Quiz 2</H4><H5 ALIGN=CENTER>Wednesday, October 2, 1996</H5> <hr><br>This quiz is 20 total points. Please write legibly. If I can't readit, I can't grade it. You have until 5 minutes after the class periodends to finish.Good luck.<OL> <LI> (2 points) What does the ``magic'' type ``<TT>const char *</TT>''allow us to do? <br> <br> <br> <br> <br> <br> <LI> (2 points)State one difference between a local variable and a <EM>call-by-value</EM>parameter? <br> <br> <br> <br> <br> <br> <LI> (2 points) What does a <tt>void</tt> keyword at the beginning of afunction header or prototype mean? <br> <br> <br> <br> <br> <br> <LI> (2 points) Based on what was said in class, when are ``global''variables acceptible to use? <br> <br> <br> <br> <br> <br> <LI> (2 points) Give one reason to use a <EM>call-by-reference</EM>(&) parameter. <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br><H5 ALIGN=CENTER>- Over - </H5> <LI> (5 points) What is the output of the following program?<PRE>#include<iostream.h>void height(int total_inches, int& inches, int& feet);int main() { int my_height = 78; int height_inches, height_feet; height(my_height, height_inches, height_feet); cout << "I am " << height_feet << " feet, "; cout << height_inches << " inches tall." << endl;}void height(int total_inches, int& inches, int& feet){ inches = total_inches % 12; feet = total_inches / 12;}</PRE><br> <br> <br> <br> <br> <br> <LI> (5 points) Exercise 7, page 184: Write a <tt>void</tt> functiondefinition for a function called <tt>add_tax</tt>. The function<TT>add_tax</tt> has two formal parameters: <tt>tax_rate</TT> which is theamount of sales tax expressed as a percentage and <tt>cost</tt> which isthe cost of an item before tax. The function changes the value of<tt>cost</tt> so that it includes sales tax.</OL></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -