Professional Documents
Culture Documents
Introduction To Computer Science: Final Exam: January 8, 2016. 9:30 - 11:00
Introduction To Computer Science: Final Exam: January 8, 2016. 9:30 - 11:00
Name: Question 4
Student ID: Which of the following statement(s) is(are) true?
Instructions: This paper consists of fifty multi-
(i) All arithmetic operations can be imple-
ple choice questions. Each carries 2 marks. You
mented by NAND gates.
have to answer all of them. For each question,
there is only ONE correct answer. Please circle (ii) Representing a negative number in
your answer by using either blue or black ball 2’s-complement formate can let addi-
pen. Using dictionary and calculator during ex- tion/subtraction easily be done by using
amination is allowed. full adder.
Question 2 Question 5
What is the name of the first electronic computer Convert −14810 in 16-bit 2’S complement
in UK? formate and then convert this binary bit pat-
terns in hexadecimal form.
(a) Babbage Difference Machine
(a) F EEB.
(b) Turing Machine
(c) Manchester (b) F F 6B.
(d) F EEC.
Question 3
Which of the following statement is the best de- Question 6
scription of the market nature of Google Play?
To manage multiple processes running on a sin-
(a) Google Play is a C2C market. gle CPU, one common method is called .
(b) Google Play is a B2B market. Difference processes are scheduled in different
time slots. So that, in each time slot, only one
(c) Google Play is a C2B market. process can use the CPU.
(d) Google Play is a B2C market. (a) Time-sharing processing
1
(b) Parallel processing Question 11
(c) Distributed processing The truth table of an half adder is shown below.
(a) 00110010, 00110001, 00110000 (d) X is a AND gate, while Y is an XOR gate.
2
Question 14 Question 18
The mission of an information system is to im- Which of the following statements about network
prove the performance of through the protocol is NOT correct?
use of information technology.
(a) Protocol is a set of rules that ensure com-
(a) computers in organizations munications among computers of different
types and from different manufacturers.
(b) people in organizations
(c) computer network (b) Protocol is a set of rules that determine the
form of signal being transmitted, encoded,
(d) people network the way that signal error is detected and
corrected, etc.
Question 15
(c) Protocol is the set of rules proposed by IBM
Which of the following systems is the most im- only.
portant system in an organization? It means
that the organization will not be functional if (d) Whenever a new technology has been intro-
such a system is missing. duced and later became commonly used, it
can be filed as a new protocol.
(a) Transaction processing systems
(b) Executive information systems Question 19
(c) Management information systems DNS refers to domain name server. Which of the
following statements about DNS is wrong?
(d) Decision support systems
(a) Each DNS consists of a table showing the
mapping of the IP addresses of all the do-
Question 16
main names in the world.
Which of the following statement(s) is(are) true?
(b) All the DNSs form a DNS network to facil-
(i) Smartphone is able to connect to the Inter- itate the search of IP address of a domain
net via 3G telecom network. name.
(ii) Smartphone is able to connect to the Inter- (c) Even if all the DNSs are down, we are still
net via WiFi. able to access a homepage.
(iii) WiFi and 3G are the same technology. (d) Even if all the DNSs are down, we are still
Answer: able to send emails.
(a) (i) only.
Question 20
(b) (ii) only.
Which of the following is(are) possible cause(s)
(c) (i) and (ii) only. for not able to access a homepage?
(d) (i), (ii) and (iii). (i) The DNS your computer is linking to is be-
ing attacked by DDoS.
Question 17 (ii) The remote web server is under DDoS at-
Which of the following has the fastest data trans- tack.
mission rate?
(iii) Your computer has not yet connected to the
(a) Shielded Twisted-Pair Internet.
(b) Unshielded Twisted-Pair (iv) You have wrongly typed the URL.
(c) Coaxial Cable Answer :
(d) Fiber-Optic Cable (a) (i) & (ii)
3
(b) (iii) & (iv) (d) <html>
<body>
(c) (i), (ii) and (iii) <meta> ... </meta>
...
(d) (i), (ii) and (iv)
</body>
(e) (i), (iii) and (iv) </html>
(c) xxx.edu.org
Question 25
(d) xxx.edu.hk In the source code of a webpage, there is a seg-
ment looking like this:
Question 22
<ol>
Which of the following languages is the earliest <li> PhD CSE CUHK
markup language for web page design? <li> MPhil CSE CUHK
<li> BENG EE PolyU
(a) Extensible Markup Language (XML) </ol>
(b) Hypertext Markup Language (HTML) Once this webpage is browsed, what will you see?
4
(a) Image file Question 30
(b) Video file What did Paul Barron propose in the computer
network?
(c) Homepage
(a) Circuit switching
(d) All of them. (b) Packet switching
(b) drawing a horizontal line with one line thick, (c) 56K bits
formatting the content within as a para-
(d) 420K Bytes
graph
5
Question 34 Question 36
Below is a program demonstrating how to enter Refer to Program A. What will you see after you
a string. have entered ”b”?
#include<stdio.h>
(a) You have successfully registered MKT.
main() /* Main function. */ You are now the 45 number of student.
{
int YOB; /* Define integer variable YOB. */ (b) You have successfully registered MKT.
int Age; /* Define integer variable Age */ You are now the 46 number of student.
char Name[32]; /* String for Name. */
(c) You have successfully registered ACCT.
printf("Please enter your name: "); You are now the 35 number of student.
scanf("%s", Name);
printf("Enter your year of birth: "); (d) You have successfully registered ACCT.
scanf("%d", &YOB); You are now the 36 number of student.
c:\> Question 38
(d) Peter, your YoB is 1990. Refer to Program B. If the following command
So, your age is 24.
is typed on the console, what will you see on the
screen?
c:\>
c:\>bubblesort a 3 6 5 4 7 9 11
Question 35
(a) a 3 4 5 6 7 9 11
Refer to Program A. What will you see after you
have entered ”a”? c:\>
(a) You have successfully registered MKT. (b) a 3 4 5 6 7 9 11
You are now the 45 number of student.
c:\>
(b) You have successfully registered MKT.
You are now the 46 number of student. (c) 3 4 5 6 7 9 11
(c) You have successfully registered ACCT. c:\>
You are now the 35 number of student.
6
Question 39 Question 43
Refer to Program B. If the following command Refer to Program C. If the numbers entered are
is typed on the console, what will you see on the ”4 5 2 1 6” and your option of sorting style is
screen? ”a”, what will you see on the screen?
c:\>bubblesort 3 6 5 4 7 9 11
(a) The sorted numbers are 1 2 4 5 6.
(a) 11 9 7 6 5 4 3
c:\>
c:\> (b) The sorted numbers are 12345.
(b) 11 9 7 6 5 4 3 c:\>
c:\>
(c) The sorted numbers are 6 5 4 2 1.
(c) 11 9 7 6 5 4 c:\>
Question 42
(a) The sorted numbers are 1 2 4 5 6.
Refer to Program B. What is the value of ”argc” c:\>
if the following command is typed?
(b) The sorted numbers are 12345.
c:\>bubblesort 3 6 5 4 7 9 11
c:\>
(a) 5
(c) The sorted numbers are 6 5 4 2 1.
(b) 6 c:\>
(c) 7
(d) The sorted numbers are 65421.
(d) 8 c:\>
7
Question 46 (c) *5
Let A is an array of n integers, and the memory (d) 5
space for an integer is 1 byte. While Bubble sort
is applied to sort this integer array, at maximum Question 49
how many number of swap operations and how
much memory space are required? If the following C program segment is executed,
what will you see on the screen?
(a) n(n + 1) swaps and n bytes memory space
i=0;
(b) n(n+1)
2 swaps and n bytes memory space While (i<=2)
{ printf("*");
(c) n(n−1) swaps and n+1 bytes memory space
i = i+1;
(d) n(n−1)
swaps and n + 1 bytes memory space }
2
printf("%d\n", i);
Question 47
(a) **2
If the following C program segment is executed,
what will you see on the screen? (b) **3
(d) *
*
*
*
Question 48
If the following C program segment is executed,
what will you see on the screen?
for (i=0,i<5, i++);
printf("*");
printf("%d/n", i);
(a) *****5
(b) *
*
*
*
*
5
8
Program A
The filename of the following program is ”registration.cpp”.
#include<stdio.h>
if (Choice == ’a’)
{
SNM = SNM + 1;
printf("You have successfully registered MKT.\n");
printf("You are now the %d number of student.", SNM);
}
else
{
SNA = SNA + 1;
printf("You have successfully registered ACCT.\n");
printf("You are now the %d number of student.", SNA);
}
9
Program B
The filename of the following program is ”bubblesort.cpp”.
#include<stdio.h>
#include<stdlib.h>
10
Program C
The filename of the following program is ”bubblesort02.cpp”.
#include<stdio.h>
main()
{
int A[5]; /* Define integer array. */
int i,j; /* Define index. */
int tmp; /* Define dummy variable for sorting. */
char OPT[8]; char Opt = ’c’;
if(Opt == ’a’)
{
for(i=0; i<4; i++)
for(j=0; j<4-i; j++)
{
if(A[j] > A[j+1])
{
tmp = A[j];
A[j] = A[j+1];
A[j+1] = tmp;
}
}
printf("The sorted numbers are %d %d %d %d %d.", A[0], A[1], A[2], A[3], A[4]);
}
else
{
for(i=0; i<4; i++)
for(j=0; j<4-i; j++)
{
if(A[j] < A[j+1])
{
tmp = A[j];
A[j] = A[j+1];
A[j+1] = tmp;
}
}
printf("The sorted numbers are %d %d %d %d %d.", A[0], A[1], A[2], A[3], A[4]);
}
}
11