乐趣区

关于算法:COMPSCI-111求解分析

QUESTION/ANSWER BOOKLET COMPSCI 111/111G
THE UNIVERSITY OF AUCKLAND
SECOND SEMESTER, 2020
Campus: City
COMPUTER SCIENCE
An Introduction to Practical Computing
(Time Allowed: TWO hours)
NOTE:
Calculators are NOT permitted.
You must answer all questions in this question/answer booklet.
There is space at the back for answers that overflow the allotted space.
Surname Model
Forename(s) Answers
Preferred Name
Student ID
Login (UPI)
Question Mark Out Of
1 – 10 Short Answers 30
11 Programming using Python 15
12 Spreadsheets 15
13 HTML5/CSS 20
14 LaTeX 20
TOTAL 100
QUESTION/ANSWER BOOKLET COMPSCI 111/111G
ID ……….…………
Page 2 of 21
SECTION A – SHORT ANSWERS
Answer all questions in this section in the space provided. If you run out of space, please use
the Overflow Sheet and indicate in the allotted space that you have used the Overflow Sheet.

  1. Artificial Intelligence (3 marks)
    What argument is Searle making in his Chinese Room discussion about the nature of
    intelligence and how it applies to Artificial Intelligence programs?
    Searle is making the argument that simple symbol manipulation, e.g.
    looking up a symbol in a table and copying over its entry, such as is
    done in the Chinese Room discussion, does not represent understanding
    the meaning of the symbol. Searle’s argument is that this is what AI
    programs do. The crux of the argument is to counter Turing’s position
    that if that we need to look at the entity as a black box and if its
    performance seems intelligent, that for our purposes, we can call it
    intelligent. However, Searle is saying that we cannot simply go by its
    performance, we have to go inside the black box and see if its
    performance goes beyond mere syntactic symbol manipulation.
    (3 marks)
  2. Software Licences (3 marks)
    What is the main difference between software that is freeware and open source software?
    The main difference between freeware and open source software is
    that freeware’s source code is proprietary and not publicly available
    whereas open source software’s source code is publicly available and
    can be used to create new software.
    (3 marks)
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 3 of 21
  3. Digital Games (3 marks)
    Give an example of a stochastic board game and of a non-stochastic board game, and
    discuss how they exemplify their type of board game.
    An example of a stochastic board game is stratego and an example of a
    non-stochastic board game is chess. In non-stochastic board games, all
    board information is known by both players and the immediate result
    of an action can be correctly predicted by both players. In stochastic
    board games, some board information is not known by both players and
    this usually means that the immediate result of an action cannot be
    correctly predicted by both players.
    In stratego, there is some board information that is only known by one
    player, e.g., the identity of his pieces when they have not attacked or
    been attacked, while there is also information that is known to both,
    e.g., the location and ownership of pieces. This means that an attacker
    does not always know what the outcome of an attack will be before he
    executes the attack.
    In chess, all board information is known by both players, so each player
    knows exactly the immediate result of their action, e.g., if they move a
    piece to a specific location containing an enemy piece, then they
    capture that piece.
  4. marks)
  5. Computer Hardware (3 marks)
    Which component within a computer (desktop or laptop) are almost all of the computer’s
    other components connected to? Describe this component’s purpose.
    The Motherboard. It provides communication between the computer’s
    components.
    (3 marks)
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 4 of 21
  6. History of Computing (3 marks)
    Describe the roles of the four people involved in preparing scientific tables before the
    advent of computers.
    Two computers who do the calculations, one comparator who checks
    their results agree and a printer who prints the results.
    (3 marks)
  7. Computer Networks (3 marks)
    Describe the difference between circuit switching and packet switching on a network.
    In circuit switching the nodes/computers are directly connected endto-end,
    and data is sent along this connection. In packet switching, the
    data is broken into packets that are routed independently across the
    network.
    (3 marks)
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 5 of 21
  8. WWW (3 marks)
    On the WWW, what is the difference between the HTTP and HTTPS protocols?
    HTTPS encrypts an HTTP connection using TLS (Transport Layer
    Security). HTTP is unecrypted.
    (3 marks)
  9. Malware (3 marks)
    What is the difference between a computer virus and a computer worm?
    A virus needs a host program to spread it. A worm can spread itself.
    (3 marks)
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 6 of 21
  10. Bits and Bytes (3 marks)
    How much memory would be required to represent 248 different values?
  11. byte (8 bits)
    (3 marks)
  12. Digital Images (3 marks)
    How much memory would be required to store a 32-colour bitmap image that is 100
    pixels wide and is 16 pixels high? Show all your working.
  13. colours requires 5 bits per pixel (2 ^ 5 = 32)
    Number of pixels = 100 * 16
    = 1600 pixels
    Number of bits required = 5 * 1600
    = 8000 bits (1000 bytes)
    (3 marks)
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 7 of 21
    SECTION B
    Answer all questions in this section in the space provided. If you run out of space, please use
    the Overflow Sheet and indicate in the allotted space that you have used the Overflow Sheet.
  14. Programming Using Python (15 marks)
    (a) The following exponential function can be used to predict the spread of flu-like
    diseases:
    𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛 𝑜𝑜𝑜𝑜 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 = 2(𝑑𝑑−1)
    where d is the day number. The value for Day 0 is defined to be 1.
    Write a Python program that calculates and displays the number of flu infections after
    a certain number of days. The number of days to predict is entered by the user. You
    can assume that the user will always enter an integer value greater than or equal to 1.
    Here are two examples of the program running with different values entered by the user.
    User input is indicated in the examples with bold and italicized font.
    Example 1:
    Enter the number of days to predict: 5
    The number of cases at day 1 is 1
    The number of cases at day 2 is 2
    The number of cases at day 3 is 4
    The number of cases at day 4 is 8
    The number of cases at day 5 is 16
    Example 2:
    Enter the number of days to predict: 1
    The number of cases at day 1 is 1
    days = int(input(“Enter the number of days to predict: “))
    day = 1
    while day <= days:
    cases = 2 ** (day – 1)
    print(“The number of cases at day “, day, “is”, cases)
    day = day + 1
    (5 marks)
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 8 of 21
    (b) Write a piece of code that prints the visibility rating for the visibility distance entered
    by the user at the prompt “Enter the Visibility Distance: “. Use the table
    below to determine the visibility rating. You can assume that the user will always
    enter a floating-point number (i.e. a float). Two examples are given below.
    Visibility Rating Visibility Distance
    Good > 6
    Fair 3 – 6 (including 3 and 6)
    Poor 1 – 3 (including 1 but not 3)
    Fog < 1
    Example 1:
    Enter the Visibility Distance: 0.2
    Your Visibility Rating is Fog
    Example 2:
    Enter the Visibility Distance: 6.0
    Your Visibility Rating is Fair
    distance = float(input(“Enter the Visibility Distance: “))
    if distance > 6:
    visibility = “Good”
    elif distance >= 3:
    visibility = “Fair”
    elif distance >= 1:
    visibility = “Poor”
    else:
    visibility = “Fog”
    print(“Your Visibility Rating is”, visibility)
    (5 marks)
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 9 of 21
    (c) In the box below, complete the code that will make the following picture. Assume
    that the turtle begins in the middle of the window facing right and that the window is
    approximately 500 steps wide. NOTE: You must use a while loop.
    import turtle
    steps = 100
    angle1 = 45
    angle2 = 90
    number_of_repetitions = 10
    step_increment = 10
    repeat_number = 0
    while repeat_number < number_of_repetitions:
    turtle.forward(steps)
    turtle.left(angle1)
    turtle.forward(steps)
    turtle.left(angle1)
    turtle.forward(steps)
    turtle.left(angle2)
    repeat_number = repeat_number + 1
    steps = steps + step_increment
    (5 marks)
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 10 of 21
  15. Spreadsheets (15 marks)
    The following spreadsheet displays information about the lunch a person had each day for one
    week.
    (a) Columns C to G of Rows 4 to 10 contain information about the lunch that the person
    had on the day specified in Column B. What is the best formula to use in Cell E4 to
    find the total number of calories the person consumed for lunch on the day specified
    in Cell B4? The calorie table is located in Cells C17 : D23. Your answer must use a
    VLOOKUP function.
    Note: Your formula must be able to be filled down from E4 to E10 correctly.
    =VLOOKUP(C4,$C$17:$D$23,2,FALSE)*D4
    (6 marks)
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 11 of 21
    (b) Cell G4 indicates the number of calories consumed for lunch on the day specified in
    Cell B4 that are under or over the goal number of calories specified in Cell E14.
    What is the best formula to use in Cell G4?
    Note: Your formula must be able to be filled down from G4 to G10 correctly.
    = E4 – $E$14
    (2 marks)
    (c) Cell E11 shows the total number of calories consumed for lunch for the week. What
    is the best formula to use in Cell E11?
    = SUM(E4:E10)
    (2 marks)
    (d) Cell E13 shows the average (mean) number of calories consumed for lunch each day.
    What is the best formula to use in Cell E13?
    = AVERAGE(E4:E10)
    (2 marks)
    (e) Cell G13 indicates whether the average number of calories in Cell E13 is under or
    over the goal number of calories specified in Cell E14. If the average is less than the
    goal value, G13 should show“Under”. If the average is higher than the goal, then
    Cell G13 should show“Over”. If the average is equal to the goal then Cell G13 is left
    blank. What is the best formula to use in Cell G13?
    Note: Your formula must use an IF function.
    =IF(E13<E14,”Under”,IF(E13>E14,”Over”,””))
    (3 marks)
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 12 of 21
    Question 13. HTML5 and CSS (20 marks)
    The following screenshot shows the body of a web page created using HTML5 and CSS:
    Complete the HTML5 code on the following pages so that it produces the output shown
    above.
    You must use the styles defined in the internal style sheet in the head section on the
    following page, and must not define any new styles.
    Note:
    (1) The URL for the University of Auckland Online Learning Resources is:
    “https://www.online.auckland.a…”.
    (2) The image is stored in a file called “AucklandOnlineImage.png” in the same
    folder as the HTML file.
    (3) There are two sections (the“Statistics”section and the“Slang Glossary”section).
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 13 of 21
    <!DOCTYPE html>
    <html lang=”en”>
    <head>
    <meta charset=”UTF-8″>
    <title>HTML/CSS Exam Question</title>
    <style>
    body {background-color: pink;
    font-family: “Arial”, “Calibri”, Sans-Serif}
    h1 {background-color:rgb(0,0,0); color:#E6FFE6;
    text-transform:uppercase; text-align:center}
    h2 {background-color:rgb(0,0,0); color:#E6FFE6;
    font-variant:small-caps}
    table, tr, td {border: 2px solid black;}

    emphasis{font-size:large; color:red}

    center {text-align:center}

    tablehead {background-color:rgb(0,0,0); color:#E6FFE6;

    font-weight:bold; text-align:center}
    .glossary{font-style:italic; font-weight:bold}
    .stat{text-align:right; font-weight:bold}
    </style>
    </head>
    <body>
    <!– Main Heading –>
    (1 mark)
    <!– Image –>
    (2 marks)
    <!– First Paragraph –>
    (2 marks)
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 14 of 21
    <!– “Student Statistics” Section –>
    (7 marks)
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 15 of 21
    <!– “Slang Glossary” Section –>
    (8 marks)
    </body>
    </html>
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 16 of 21

  16. LaTeX (20 marks)
    On the following pages, complete the LaTeX code that will produce the output below:
    The image is stored in a file called Covid.png and is in the same folder as the LaTeX
    code. When inserted into the document, the image should be centred and 6 cm wide.
    The following LaTeX commands have been included as a reference. You will not need to
    use all of these commands.
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 17 of 21
    Normal commands Environments Math mode commands
    \usepackage{graphicx}
    \section{}
    \subsection{}
    \title{}
    \author{}
    \date{}
    \maketitle
    \item
    \textbf{}
    \emph{}
    \includegraphics{}
    \footnote{}
    itemize
    enumerate
    verbatim
    flushright
    center
    quote
    displaymath
    equation
    quotation
    $
    \sqrt{}
    \frac{}{}
    \leq
    \sum_{}^{}
    \infty
    \sigma
    ^
    _
    \left(
    \right)
    (20 marks)
    \documentclass[a4paper]{article}
    \begin{document}
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 18 of 21
  17. Overflow Sheet 1 –
    Write the question number and letter next to your answer. You must ALSO indicate in
    the allotted space that you have used the overflow sheet.
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 19 of 21
  18. Overflow Sheet 2 –
    Write the question number and letter next to your answer. You must ALSO indicate in
    the allotted space that you have used the overflow sheet.
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 20 of 21
    Rough Working – This page will not be marked
    QUESTION/ANSWER BOOKLET COMPSCI 111/111G
    ID ……….…………
    Page 21 of 21
    Rough Working – This page will not be marked
    __
退出移动版