CS 151 - Key Skills - Quiz

From Computer Science
Revision as of 03:54, 10 January 2020 by Jkinne (talk | contribs) (Base System)
Jump to: navigation, search

Note that this is an example of what can be used as a quiz over CS 151 material for courses that have CS 151 (or CS 201 or 202) as a prerequisite. For example, those taking CS 201 are assumed to have gained/retained the skills/knowledge to do well on this quiz.

Note that this sample quiz is not exhaustive. See CS 151 - Key Skills for a full list of the key skills.

Note that for an actual quiz, it is likely that the following questions would be put in random order and your instructor would likely only take a subset of each type.

Note - please do study these, and the rest of the items from the CS 151 - Key Skills! We want you to be ready for the class, and studying for this skills quiz should help!

Linux and Terminal

Fill in the blank, what is the shortcut or key used in the linux terminal for each of the following.

  • Press this key to execute a command:
  • Keys that let you run a previously typed command again:
  • Key to press to auto-complete a filename or command:
  • Shortcut for current directory (one character):
  • Shortcut for directory one level up from current:
  • Shortcut for your home directory (one character):
  • Shortcut for the top of the entire file system (one character):
  • Characters to put around a filename that has spaces:
  • Wildcard character:

Fill in the blank, what is the linux command to do each of the following.

  • Get how long since last system reboot:
  • Get information about disk free space:
  • Get which user is currently logged in on the terminal:
  • Get what computer are you currently running commands on:
  • Get which directory are you inside of:
  • Clear the terminal screen:
  • See which other users are currently logged in:
  • Help about a command (manual):
  • Change directory:
  • Make a new directory:
  • List directory contents:
  • Flag/option to use with previous command to list details of files:
  • Copy file(s):
  • Remove files:
  • Remove directory:
  • Move or rename a file or directory:
  • A terminal text editor:
  • Change your password:
  • Print out first few lines of a file:
  • Change file permissions:
  • Display current system memory usage:
  • See current time and date:

Give the complete linux terminal command to complete each of the following tasks. Tasks such as these could be asked about.

  • Create a new directory HELLO in your home directory:
  • Copy the contents of jkinne's GREAT directory into your home directory:
  • Change directory to your home directory:
  • Check to see who is logged in:
  • List the contest of the directory ~cs151/ including the sizes of the files:

Python Keywords and Functions

What is the python keyword or function for each of the following.

  • exit the current loop:
  • in a loop, go to next iteration of the loop:
  • determine whether two objects are the same object (not just value):
  • load a module (two keywords):
  • declare a function:
  • loop with only condition:
  • conditional statements (three keywords):
  • loop with that iterates through a list:
  • keyword to send a value back from a function:
  • boolean operator, True only if both sides are True:
  • boolean operator, True if either side is True:
  • boolean operator, negates:
  • boolean values (two keywords):
  • remove from a list by position:
  • handle an exception, basic use (2 keywords):
  • raise/indicate an exception (2 keywords):
  • test if something is inside of a list/string/tuple/dictionary:
  • special value for a variable that has no value:
  • empty statement that does not do anything:
  • function to write to the screen:
  • functions to convert to integer, floating point number, or string (3 functions):
  • function to generate a sequence of numbers:
  • function to get the length of a string, list, or tuple:

What is the name of the following programming concept.

  • text data type:
  • data type for True and False:
  • data type that stores numbers with fractional parts (e.g., 3.14 or 2.2):
  • data type that stores only integers:

Python Operators and Expressions

What are the Python3 operators for each of the following.

  • multiplication, subtraction, addition:
  • integer division:
  • floating point division:
  • remainder:
  • exponentiation:
  • testing membership in a string, tuple, or list:

Evaluate the following Python3 expressions. Expressions similar to these could be asked.

  • 4 - 2 * 1
  • 1 + 2 ** 3
  • 7 // 2
  • 'hello'[0:2]
  • range(0, 4)
  • '3' + '2'
  • int('3') + int('2')
  • '3' * 2
  • 'Hello'.upper()
  • len('hi there')

Basic Python Programs

Write a complete and correct Python3 program to do the following. Programs of similar complexity as these could be asked.

  • Print the integers from 1 to 10 along with those numbers squared.
  • Take two integers as input from the user and print a rectangle of *'s with those dimensions.
  • Ask the user for the answer. If they type "42", print "but what is the question.". If they don't type "42" ask again, and keep asking until they type "42".
  • Print the powers of 2 up to 1024 (which is 2**10).

Play Computer

Write down all variables in each of the following programs and keep track of their values as well as what is printed on the screen. Programs of similar complexity as these could be asked.

def fun(n):
  if n <= 0: return
  print(n)
  fun(n//2)
fun(42)
for i in range(0, 5):
  for j in range(i, 5):
    print('x'*j)
L = 'what is the meaning of this?'.split()
for x in L:
  print(x, 'a' in x)

Math

Complete each of the following math rules.

  • 2a+b =
  • ya * yb =
  • logbx = y, means:
  • logb(xy) =
  • Arithmetic Sum: (1 + 2 + ... + n) =
  • not (A and B) is equivalent to:

CS Terms

What is the definition of each of the following.

  • bit:
  • byte:
  • KB:
  • K Hz:
  • RAM:
  • SSD:
  • CPU:

Base Systems

Do the following conversions between bases.

  • Convert 15 from decimal to binary:
  • Convert 1010 from binary to decimal:
  • Convert 1010 from binary to hexadecimal:

What is the largest number possible for each of the following.

  • Decimal number with 3 digits:
  • Binary number with 3 bits (it's binary and decimal value):
  • Hexadecimal number with 1 digit (it's hex and decimal values):