100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CPEN 333 – Midterm Exam Questions with 100% Correct Answers 2024

Rating
-
Sold
-
Pages
17
Grade
A+
Uploaded on
20-03-2024
Written in
2023/2024

CPEN 333 – Midterm Exam Questions with 100% Correct Answers 2024 What is an Operating System? - answerA program that acts as an intermediary between a user of a computer and the computer hardware, and provides an environment in which a user can execute programs. What are the goals of an Operating System? - answer Execute user programs and make solving user problems easier; Make the computer system convenient to use; Use the computer hardware in an efficient manner. Real-Time System classifications include? - answer Hard real-time systems - task must be serviced by its deadline Soft real-time systems - no definitive guarantee as to when the critical real-time process will be scheduled (system degradation) "Python Fundamentals" Learning Goals - answer Describe the general structure of a python program Declare and use variables Design branching structures (if, if-else, nested if, elif) Design repetition structures (for, while, while-else) Design functions and modules Use built-in functions Python is classified as an _________ language - answerinterpreted To comment multiple lines, we can use three quotes/double quotes called a __________ - answerdocstring (usually used as a first statement in a function, class, module ... as documentation comment.) Ex. """ This function periodically controls the LEDs based on the required pattern.""" Is Python case sensitive? (is x != X ?) - answeryes Python is dynamically typed. What does it mean? - answerThe interpreter type checks at runtime, and the type of a variable is allowed to change over its lifetime. What mechanism helps with readability and allow us to have better type checking (by checkers, IDEs, linters, etc)? - answerType hints Ex. grade: int = 1 text: str = "Excellent" threshold: float = 1.5 But this is just effectively a comment meant for readability. Python doesn't care about it. To indicate a block of code, what does Python require? - answerIndentation Is the following code allowed? for _ in range(3): - answerYes, _ is a general purpose throwaway variable Is there a need for parenthesis for the condition of an if statement? - answerNo, it is optional What keyword do we use to define/create a function/method? - answerdef Examples of functions - answerdef func1() -> None: def func2(a: float, b: float) -> None: print(a,"+",b,"=",a + b) def func3(a: float, b: float) -> float: Arithmetic Operators - answer+ Addition - Subtraction * Multiplication / Division % Modulus ** Exponentiation (important, as it is not ^) // Floor division (important, to ensure result is an integer) What is an identity operator and a membership operator? - answeris = Identity operator (returns True if both are the same object). Ex. x is y in = Membership operator (returns True if the specified value is present in (a member of) the object). Ex. x in y What file does Python put related definitions (functions, classes, variables) into? - answermodule (Ex. math, tkinter, threading, os, socket, ...) We can also create our own module by storing our own function or class definitions in a file (with extension .py) What is the difference between import versus from-import? - answerImport = imports the entire module (Ex. root = tkinter.Tk()) From-import = imports just the specified function, being able to use it without stating the module first (Ex. root = Tk()) (doesn't need tkinter) What is if __name__ == "__main__": ? - answerIf this file is the one being run directly (as opposed to being imported), then run the statements in the if body. __name__ (two underscores preceding and following) is an internal variable that holds the name of the current module. __main__ is the name of the top-level environment of a program, but when a python module is imported, __name__ is set to the module's name. This allows a program to be directly run or be safely imported (or for unit testing purposes). What does a semicolon do in Python? - answerDenotes separation (instead of putting code in a new line; usually not a good style) What does [] indicate? - answerList What does {} indicate? - answerSet or dictionary List initialization examples - answerlist1 = [] # create an empty list list2 = [2,3,4] # create a list with elements 2, 3, 4 list3 = ["red","green"] # create a list with strings list4 = [2,"three",4] # A list can contain mixed types two = list4[0] # stores 2 (element 0 of list4 in two) d(5) # modifies list2 to have 2, 3, 4, 5 Object-Oriented Programming (OOP) Learning Goals - answer Design classes and define objects Use python data types, e.g. list

Show more Read less
Institution
CPEN
Course
CPEN










Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CPEN
Course
CPEN

Document information

Uploaded on
March 20, 2024
Number of pages
17
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
TheStar Florida State University
View profile
Follow You need to be logged in order to follow users or courses
Sold
607
Member since
2 year
Number of followers
178
Documents
24049
Last sold
18 hours ago
Stuvia Prodigy

Tested, Verified and Updated Study Materials with 100% Guaranteed Success.

3.8

121 reviews

5
58
4
21
3
21
2
4
1
17

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions