MID TERM SAMPLE QUESTIONS


History of Computers
====================

1) At the lowest levels of a computer we have :
    a) electronic circuits (hardware) and programs (software)
    b) electronic circuits (hardware) only
    c) programs (software) only
    d) a hamster running in a wheel
    e) none of the above

2) Rate these from smallest to largest
    a) bit, byte, kilobyte, megabyte, gigabyte
    b) bit, byte, gigabyte, megabyte, kilobyte
    c) kilobyte, gigabyte, word, megabyte, byte, bit
    d) bit, byte, word, integer, character
    e) integer, character, real, word

3) John Mauchly created the first :
    a) mechanical adding machine in the 1600's
    b) abacus in ancient asia
    c) electronic numerical integrator and calculator 
    d) Atansoff - Berry Computers (aka ABC machines)
    e) none of the above

4) John Von Neumann :
    a) was a Russian defector who helpped the Americans with the German Colossus
    b) created ENIAC
    c) is credited with the idea of the first stored program computers
    d) has nothing to do with computers
    e) is your TA


Binary, Octal and Hexidecimal Numbers
=====================================

5) Binary numbers are numbers in which base?
    a) 10
    b) 16
    c)  8
    d)  2
    e) 12

6) Convert this base 10 number into an unsigned base 2 number
   230 in base 10 is ???? in base 2.
    a) 1110 0110
    b) 0101 0101
    c) 1100 1001
    d) 0011 1111
    e) None of the above

7) Convert this UNSIGNED binary number to an unsigned octal number
   1110 0110 in binary is ??? in octal.
    a) 712
    b) E6
    c) 346
    d) 123
    e) You cannot convert that number, it doesn't have enough digits

7) Convert this UNSIGNED binary number to an unsigned hexidecimal number
   1110 0110 in binary is ?? in hexidecimal.
    a) E6
    b) 1C
    c) B7
    d) H1
    e) 320


Operations
==========

8) Add these two unsigned binary numbers
      0010 1001
     +0111 0011
     ----------
   a) 0001 1100   
   b) 0011 1011
   c) 0111 0001
   d) 1001 1100
   e) None of the above

9) Subtract these 2 unsigned binary numbers
      0111 0001
     -0010 1001
     ----------
   a) 0010 1001
   b) 0111 0011
   c) 0010 0001
   d) 0101 0000
   e) None of the above


Unix
====

10) To copy the file from /home/215/notes/week1.txt to your own directory you would type :
   a) mv week1.txt ~/
   b) cp ~/week1.txt ~/
   c) cp /home/215/notes/week1.txt
   d) mv /home/215/notes/week1.txt
   e) none of the above

11) The proper UNIX command to grant file permissions is :
   a) grant < file > < person >          example: grant asmt1.p marina 
   b) grant < file > < permissions >     example: grant asmt1.p a+r
   c) chmod < permissions > < file >     example: chmod a+r asmt1.p
   d) grant < permissions > < file >     example: grant a+r asmt1.p
   c) chmod < file > < permissions >     example: chmod asmt1.p a+r

12) Which UNIX command allows you to read e-mail on our system?
   a) pine
   b) rm
   c) gimp
   d) xv
   e) You cannot read mail on any UNIX system with any of those

13) Compiling a program, then editing the Pascal program in EMACS will :
   a) cause the compiled file to fail all the time
   b) have no effect on the compiled file
   c) cause the compiled file to fail BUT only after it is saved
   d) cause the compiled file to fail BUT only before it is saved
   e) cause your system to reboot

14) UNIX is :
   a) an operating system
   b) the cables which connect printers, mice, and keyboards to the computer
   c) not used at the university
   d) a single user operating system only
   e) none of the above

Pascal Code
===========

15) Every Pascal Program needs the following :
   a) a name, a block count, a for loop, and a variable
   b) a for loop, an if statement, a BEGIN statement, and a variable
   c) a variable, a for loop, a BEGIN statement, and an END statement
   d) a variable and any given number of statements
   e) a header and a body

16) Which statement executes a loop until a stated condition is true?
   a) repeat
   b) while
   c) if
   d) for
   e) else

FOR QUESTIONS 17-20 CHOOSE WHICH LINE HAS THE ERROR ON IT.
ASSUME ALL DATA TYPES ARE CORRECT.

17)
   a)   if (a=b) then write("Hi Mom!");
   b)   else BEGIN
   c)     write('By Mom!');
   d)   END;
   e) { There are no errors in the above code }

18)
   a)   readln(b);
   b)   if (a==b) then write("Show me the way to go home....").
   c)   else writeln('I'm tired and I wanna go to bed.');
   d) END.
   e) { There are no errors in the above code }

19)
   a)   write('I had a couple of drinks about an hour ago.');
   b)   write('Psst, what did you get for number 19?''');
   c)   while (NOT b) do BEGIN read(b); END;
   d) END.
   e) { There are no errors in the above code }

20)
   a) b=readln();
   b) if (b=c) then a:=b;
   c) if (c=a) then b:=a;
   d) c:=b;
   e) { There are no errors in the above code }