Docsity

S364 Midterm Practice Test: Python Programming Concepts, Exams of Advanced Education

Toggle sidebar
bg1
S364 MIDTERM PRACTICE TEST
Modulus Operator - ANSWER -an operator denoted with a percent sign (%)
that works on integers and yields the remainder when one number is divided by
another
Statement - ANSWER -a section of code that represents a command or action.
Floating Point - ANSWER -a type that represents numbers with fractional parts
assignment - ANSWER -A statement that assigns value to a variable
An operator that joins strings together. For example: "Hello" operator "World!"
result in "Hello World!" - ANSWER -+
Data type that the value 5.3 has - ANSWER -float
Reasons to use comments in code - ANSWER -describe or explain the code
logic
-hide some code form the interpreter so they won't be executed
-provide information such as the author, version, date of code
Python code is always executed from the top to bottom without any exceptions -
ANSWER -False
Sequential - ANSWER -execute the code line by line in the order written
-this is the default execution flow
conditional - ANSWER -at a decision point, the code execution go through
different branches that are mutually exclusive
Loop - ANSWER -execute certain code repeatedly for multiple number of
times
pf3

Partial preview of the text

Download S364 Midterm Practice Test: Python Programming Concepts and more Exams Advanced Education in PDF only on Docsity!

S364 MIDTERM PRACTICE TEST

Modulus Operator - ANSWER - an operator denoted with a percent sign (%) that works on integers and yields the remainder when one number is divided by another Statement - ANSWER - a section of code that represents a command or action. Floating Point - ANSWER - a type that represents numbers with fractional parts assignment - ANSWER - A statement that assigns value to a variable An operator that joins strings together. For example: "Hello" operator "World!" result in "Hello World!" - ANSWER - + Data type that the value 5.3 has - ANSWER - float Reasons to use comments in code - ANSWER - describe or explain the code logic

  • hide some code form the interpreter so they won't be executed
  • provide information such as the author, version, date of code Python code is always executed from the top to bottom without any exceptions - ANSWER - False Sequential - ANSWER - execute the code line by line in the order written
  • this is the default execution flow conditional - ANSWER - at a decision point, the code execution go through different branches that are mutually exclusive Loop - ANSWER - execute certain code repeatedly for multiple number of times

Function - ANSWER - Pre-defined code module executed when needed

  • a statement that creates a new function, specifying its name, parameters, and the statements it executes Exception handling - ANSWER - purposefully designed code executed when when unexpected problems occur in normal execution dot notation - ANSWER - the syntax for calling a function in another module by specifying the module name followed by a dot (period) return value - ANSWER - the result of a function passed back to the caller void function - ANSWER - a function that does not return a value import statement - ANSWER - a statement that reads a module file and make the module functions available argument - ANSWER - a value provided to a function when the function is called parameter - ANSWER - a name used inside a function to refer to the value passed as an argument def - ANSWER - keyword that indicates the start of a function for sequential access of a file: - ANSWER - read the file from beginning to end, cannot skip ahead
  • once a piece of data is read, cannot read it again Open a file to write to it - ANSWER - w good candidates for try/except structure - ANSWER - A number expected from a user input but the user enters letters such as A, B, C
  • Try to open a file with user provided file path but the file path is incorrect to determine the length of a string that is in a variable - ANSWER - len()