CS 1400 exam 1
59 flashcards · Computer Science · by Elsa Schutfort
How many bits does one byte have?
8
Computer memory (RAM) is volatile
true
What does CPU stand for and what is its function?
Central processing unit , most important piece, processes the data in the computer.
What is an Assembly Language?
Uses an assembler to convert to machine code. uses a short instruction that can be translated into machine language, and easier than writing in machine language
Complier
creates a new file to run a code
Three major tasks of an Operating System
Controlling and monitoring system activities, scheduling operations, allocating and managing system resources
CPU (Match speed to each component)
Fastest
Memory (Match speed to each component)
Fast
Storage (Match speed to each component)
Slow
What language does a CPU understand?
machine language
Do coding rules need to be followed in order for a program to execute properly on a computer system?
Yes
Do coding conventions need to be followed in order for a program to execute properly on a computer system?
No
What type of error prevents a program from running at all?
Syntax Error
What causes a run-time error?
Happens when python can't understand what you're saying
What causes a logic error?
caused by a mistake in the program's logic
What units is used to measure CPU?
GHz
What language does a CPU understand?
machine language
What is the end parameter?
end""
val = input()
allows val to be assigned a string that is received from a user
val = float(input())
converts users input into a float
str(a)
converts values into string form
Step of Software Development Process that is concerned with user's perspective
Requirements Specification
value //= 2
changes the value when printing
Proper name for a constant value according to standard naming conventions
MAX_VAL
Multiple Assignment
Making more than one assignment to the same variable during the execution of a program (val1 = val2 = 5)
Scope
the term that defines the rules where a variable/identifier can used (the rule that a variable must be declared/created before it is used is part of this)
modules in python
they exist inside of libraries and hold extra function (ex. turtle, math, time)
escape sequence to insert a newline in a string
\n
What is 10 in 10.2f
width
What is 2 in 10.2f
the precision
What is f in 10.2f
float can be a s for string
=+ 10.2f
adds plug then puts the padding
< 10.2f
left aligns the results
> 10.2f
right aligns the result
^10.2f
center aligns the results
volatile
data disappears when power is removed
Interpreted High-Level language
Python is an example of an
type(a)
returns the type of data (ex. string, float, int)
-=
subtracts and assigns
Step of the Software Development Process that is from the developers perspective
System Design
importing just factorial
from math import factorial
math.pow(a, b)
a^b
What is a string literal?
any text in between a set of quotes
id(a)
returns the identity of the object
How do you put quotes in a print statement?
\"[insert]\"
+=
add and assigns
**
exponentiation (3 ** 2 = 9)
%
modulus or remainder operator (5 % 2 =1)
Concatenation
linking into chains
banking rounding
round to the nearest even whole number
round(val, number)
needs to be given a number to round with
Scope issues
runtime errors if the variable is given after it's used
print("Hello" + "Goodbye")
HelloGoodbye
print("insert" + val1 + val2)
Run-time error because val1 and val2 aren't strings
//
integer division (1/2 = 0)
/
floating point division
+
binary addition and unary positive
-
binary addition and unary negative
*
binary multiple