Garantie de satisfaction à 100% Disponible immédiatement après paiement En ligne et en PDF Tu n'es attaché à rien 4.2 TrustPilot
logo-home
Examen

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

Note
-
Vendu
-
Pages
17
Grade
A+
Publié le
20-03-2024
Écrit en
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

Montrer plus Lire moins
Établissement
CPEN
Cours
CPEN










Oups ! Impossible de charger votre document. Réessayez ou contactez le support.

École, étude et sujet

Établissement
CPEN
Cours
CPEN

Infos sur le Document

Publié le
20 mars 2024
Nombre de pages
17
Écrit en
2023/2024
Type
Examen
Contient
Questions et réponses

Sujets

€11,49
Accéder à l'intégralité du document:

Garantie de satisfaction à 100%
Disponible immédiatement après paiement
En ligne et en PDF
Tu n'es attaché à rien


Document également disponible en groupe

Faites connaissance avec le vendeur

Seller avatar
Les scores de réputation sont basés sur le nombre de documents qu'un vendeur a vendus contre paiement ainsi que sur les avis qu'il a reçu pour ces documents. Il y a trois niveaux: Bronze, Argent et Or. Plus la réputation est bonne, plus vous pouvez faire confiance sur la qualité du travail des vendeurs.
TheStar Florida State University
S'abonner Vous devez être connecté afin de suivre les étudiants ou les cours
Vendu
607
Membre depuis
2 année
Nombre de followers
178
Documents
24049
Dernière vente
16 heures de cela
Stuvia Prodigy

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

3,8

121 revues

5
58
4
21
3
21
2
4
1
17

Récemment consulté par vous

Pourquoi les étudiants choisissent Stuvia

Créé par d'autres étudiants, vérifié par les avis

Une qualité sur laquelle compter : rédigé par des étudiants qui ont réussi et évalué par d'autres qui ont utilisé ce document.

Le document ne convient pas ? Choisis un autre document

Aucun souci ! Tu peux sélectionner directement un autre document qui correspond mieux à ce que tu cherches.

Paye comme tu veux, apprends aussitôt

Aucun abonnement, aucun engagement. Paye selon tes habitudes par carte de crédit et télécharge ton document PDF instantanément.

Student with book image

“Acheté, téléchargé et réussi. C'est aussi simple que ça.”

Alisha Student

Foire aux questions