click below
click below
Normal Size Small Size show me how
Compsci 111 Quiz 1
Lecture 1 and 2
Question | Answer |
---|---|
what are the fundamental ideas of comp sci? | -Information processing -Automation -Efficiency -Algorithms |
what is a pseudocode? | a notation resembling a simplified programming language, used in program design |
immediate mode? | python code written in interpreter window gets evaluated immediately |
script mode? | blank file, doesn't run immediately |
why python? | -easy to understand -popular and widely known -pseudocode that runs |
What is the logistic flow of python program? | 1) Read an expression 2) Evaluate it 3) Print result (Repeat) |
what is scripting? | -involves writing code in a file -transferable to other machines and can be used later |
what does IDE stand for? | Integrated Development Environment |
what is a program? | sequence of instructions that specifies how to perform a computation |
difference between an algorithm and a program? | -algorithm: thinking of way to solve an issue -program: very literal |
What are the components of a program? | -Input -Output -Computation -Conditional Execution -Repetition |
Input | Get data from source and then we process the data so its usable by the program |
Output | What you want to display to the user. A signal sent as a result of your program |
Computation | Some type of computation or numerical analysis Normally contains algorithmic process |
Conditional Execution | Checking for conditions w/in the program and executes the correct sequence of statements. Some code may not be executed (hence conditional) |
Repetition | Performing the action multiple times and normally controlled by conditional execution ->reduces the amount of code needed to run |
How literal are programs? | VERY literal. Must explain step-by-step |
Natural Language vs Formal Language | Normal: language people speak, evolves naturally Formal: has clear rules to express computation |
Semantics ex) | X = 2 Y = 2 + 3 // 2 Strings-> "this is my python string" |
What are the two ways to comment? | Using # or Docstrings |
What's a docstring? | Not evaluated b/c its a type of comment. Appears at the beginning of files or functions/methods Important b/c it allows you to understand the file |
Python Process | IDLE editor ->Python source code Python compiler ->Byte code +Input from user Python Virtual Machine(PVM) ->output |
Structure of Python Program | Docstring Import Statements Input Statements Computation Statements Output of Statements |
What do all Python files end with? | .py |