Professional Documents
Culture Documents
Fall 2013
Exam 1B
Instructions: You have 1 hour and 20 minutes to complete this exam. If you finish
early you may quietly leave the room. Please show all of your work if you want to
receive partial credit. Keep your eyes on your own exam. At this time please enter
your name below and initial the bottom of each page. You may begin the exam once
everyone has completed this task and you are instructed to begin.
1. TRUE or FALSE
A bus is a group of parallel wires that carry control signals and data between other
components and serves as the main communication between components.
2. TRUE or FALSE
Putting memory into a particular memory address is considered a WRITE.
3. TRUE or FALSE
A peripheral device is an integral part of the computer.
4. TRUE or FALSE
The monitor is considered a secondary storage device.
5. TRUE or FALSE
Linux filenames are case sensitive.
6. TRUE or FALSE
The hard disk is considered volatile memory.
7. TRUE or FALSE
The “brain” of the computer is considered the CPU.
8. TRUE or FALSE
The command in Linux to rename a file is ren.
9. TRUE or FALSE
Computers store values using the binary number system.
14. TRUE/FALSE
If n is an integer variable, the value of the expression n % 6 is always less than 6.
15. TRUE/FALSE
The order in terms of quickest to slowest access of the following components in
your computer is cache, registers, main memory, and hard drive.
16. TRUE/FALSE
A Python program that prints three lines of output must contain three print
statements.
17. TRUE/FALSE
The Linux command grep rep myfile displays all the lines in myfile that
begin with the letters rep.
18. TRUE/FALSE
There are 32 bits in a byte.
19. TRUE/FALSE
Reading from a memory location alters its contents.
20. TRUE/FALSE
If x = 2 and y =3 then y**x is 8.
[a.] UNIX
[b.] ls
[c.] Putty
[d.] vi
[a.] 4
[b.] -3
[c.] 0
[d.] none of the above.
4. Each cell of memory is numbered and that number is considered the memory's
[a.] address.
[b.] block.
[c.] size.
[d.] name.
6. A byte is composed of
[a.] 4 bits.
[b.] 8 bits.
[c.] 16 bits.
[d.] 32 bits.
[a.] rm
[b.] del
[c.] pwd
[d.] mv
[a.] the contents of the memory are lost when the computer is turned off.
[b.] it may change at any time without warning.
[c.] the memory may be easily removed from the computer.
[d.] unless problems occur, the memory is not corrupted when the computer is
turned off.
9. The Linux command to view the absolute path of the current directory is
[a.] cwd
[b.] del
[c.] pwd
[d.] cd
[a.] repetition control structure meaning that the code is executed several times.
[b.] selection control structure meaning only one selection of the code is executed.
[c.] sequential control structure meaning each line of code is executed sequentially.
[d.] looping control structure meaning that the if statement causes the code to loop.
[a.] Adds read, write, and execute permissions for a file named temp
[b.] Removes read, write, and execute permissions for a file named temp
[c.] Sets read, write, and execute permissions for a directory named temp
[d.] Adds read, write, and execute permissions for the owner a directory named
temp
[a.] Sets read, write, and execute permissions for the group of the file
goodbye.java
[b.] Sets read, write, and execute permissions for the others of file goodbye.java
[c.] Sets read, write, and execute permissions for a file named goodbye.java
[d.] Sets read, write, and execute permissions for the owner of the file
goodbye.java
def greeting(hora):
if(hora <= 11):
print “Buen dia”
elif(hora <=18):
print “Buenas tardes”
else:
print “Buenas noches”
greeting(18);
[a.] gives an error [b.] “Buenas tardes” [c.] “Buenas noches” [d.] does nothing
Short answer
Show all work to receive partial credit.
0243 _____________________________________
2. (2 pts.) Give the Linux command that creates a directory named CCOM3030 under
the current directory.
_____________________________________________
3. (2 pts.) Name two ways to get to your home directory no matter where you are in
Linux:
a. _________________________________________
b. _________________________________________
4. (2pts.) Give the Linux command that moves the file named first.pl into the
subdirectory proj1 where both the file and the subdirectory are in the current
working directory.
__________________________________________________
0xf407 _____________________________________
0745 _____________________________________
2011 _____________________________________
6. (2pts.) Give the UNIX command that lists all files in the current directory that
begin with the letters fun.
_____________________________________________
Write a program for the “Guess the Number” game. The player may guess a total of 6
times before they have lost. The program must prompt the user for their name
when they begin the game and prompt them for a number every time they are going
to try to guess the mystery number. The number to guess is between 1 and 20 and
you may use functions from Python’s library like random.randint(1,20) to generate
the mystery number. (Remember to use “import random” at top of program). Five
points extra credit for those who manage to incorporate functions into their
program and can keep track of the number of guesses of the player. You may use
the back of this page to write your program and take notes on this page. Partial
credit will be given for ideas of how the program should work.
Sample output:
Hello! What is your name?
Albert
Well, Albert, I am thinking of a number between 1
and 20.
Take a guess.
10
Your guess is too high.
Take a guess.
2
Your guess is too low.
Take a guess.
4
Good job, Albert!
You guessed my number in 3 guesses! Extra Credit