Midterm Exam 2 Quizzes
Which of the answers below correctly describes (a) a float, (b) an integer, and (c) a string?
(a) any type of content, (b) numerical values, (c) text content **(a) any real number, (b) any whole number, (c) any text value (a) any fractional number, (b) any whole number zero or larger, (c) any short text (a) any textual content, (b) any whole number, (c) any numerical value
What is the maximum number of lines that can flow OUT of a process symbol?
**1 0 There is no maximum. 2
Given the following program: favinteger = input("Please enter your favorite integer: >") print("Your favorite integer is: %d" % (favinteger)) If the user inputs 19 as their favorite integer, what would the output be?
**An error Your favorite integer is: 19. Your favorite integer is 19 Your favorite integer is: favinteger
What would be the output of the following? formats = ["slalom", "giant slalom", "super-g", "downhill"] print(formats[4])
**An error, since there's no value that corresponds to formats[4]. downhill 3 super-g giant slalom
You've just been made the requisitioner for a new software project at your company. During which of the following stages would you go about soliciting the wants and needs of people in the company who will be affected by the project's outcome? (Choose the best answer.)
**Analysis Development Lent Planning Design
Which one of the following is the best example of a project?
**Having been given a court order to do so, Walter writes a one-page letter to his friend in Ottawa. Throughout her lifetime, a dog digs a hole in the middle of the back yard, even though it leads to nowhere. Sally passes the Centerville exit and continues down the freeway. The IT department at a company performs ongoing maintenance on company PCs to ensure they work correctly.
If I want to write a SELECT query that pulls records in which a certain field's value matches the value of a variable I declared in my program, the query I type into my Python code must... (Choose the best answer.)
**Include a placeholder. Include quotes around the variable name. Include a * in the SELECT clause. Include the name of the variable in the WHERE clause.
x = -15 while (x < 15): x += 1 if x < 0: print("Hmmm. Negative, huh?") if x >= 0: print("Hmmm. Positive, eh?") When executed, would the code cause an error?
**No Yes, the second if needs to be an elif or else Yes, x is not properly declared Yes, the else is missing
When establishing the connection between Python and SQL Server in your Python code, indicating "yes" for a trusted connection means that...
**The database is free to make changes to your Python code. The program doesn't need a user ID and password to access the database. The database can only be queried via Python. Python can use INSERT, UPDATE, and DELETE when communicating with SQL Server.
In Python, to cause a new record to be created in a table...
**You must first execute the query, then commit it. Your INSERT query must reference the primary key field. Trusted_Connection must be set to 'yes'. Your must use a conn query.
customers = ["Jan", "Scott","Cindy","Michael"] What do you expect the following to print to the console? print(customers[1:3])
**['Scott', 'Cindy'] Nothing will return. ['Jan', 'Scott', 'Cindy', 'Michael'] ['Scott', 'Cindy', 'Michael']
What would be the output of the following? print ("cat")
**cat No output "cat" print
What would be the output of the following? corgtype = "Pembroke" print(corgtype[2:4])
**mb emb embr mbr
counter = 0 x=16 while (x>12): print(x,counter) counter += 1 x -= 1 What would the last line of this program read?
12 4 Nothing. An error would occur. **13 3 13 5
What would be the output of the following? autocorrectisawful = 4 while (autocorrectisawful > 0): print(autocorrectisawful) if (autocorrectisawful == 2): break autocorrectisawful -= 1
43 431 **432 4310 4321
What would be the output of the following? fred = 4 ** 2 print (fred)
8 42 2 **16
Sometimes it's useful to "store information" within a flowchart (e.g., something that the user has inputted). We often do this by using which of the following?
A Disk Symbol **A Variable A Database Symbol An Asterisk A Connector
Which of the following is true regarding environments?
A software project is tested in the QA environment, then used by end-users in the dev environment. A software project is coded in the production environment and tested in the QA environment. A software project is tested in the dev environment and pushed to live users in the QA environment. **A software project is coded in the dev environment and goes live into the production environment.
While creating a flowchart, you reach a step that seems like an action, but also requires input. This step should probably be shown as... (Choose the best answer.)
Action Connector Decision **Input
According to the Waterfall methodology...
After analysis is done, planning begins. **Once the planning phase is done, the phase is not revisited. After design is done, planning begins. The steps of SDLC can be followed in any order.
When I write a SELECT query via Python, each row of output is represented in the program as...
An Output **A Tuple A List An Undefined Object
An IDE allows you to... (Choose the best answer.)
Create visual diagrams of your program before you start coding. **See your code as well as your code's output when you run it. "De-compile" any application into corresponding Python code. Develop programs using a simple drag-and-drop system.
During which phase does a new software project arrive in the production environment?
Development Testing **Implementation Maintenance
A flowchart is particularly valuable in that it enables us to... (Choose the best answer.)
Enlarge the solution space. **Break a process into its component parts. Solve arithmetic problems. Quickly solve a simple problem.
A development project is originally scheduled to take 12 months to complete. During month three, however, the CEO is told by the board of directors that she needs to show that she can get things done and that she has six months to prove it to them. As a result, she insists that this important project be done in only four more months. Given this new, accelerated timeline, which of the following is likely to occur?
If the scope of the project remains the same, then the cost shouldn't have to increase. No other answer is correct. The cost will go down, since the duration of the project will be shorter. **The cost will go up and/or the scope of the project will need to shrink.
And then, if I DO see a rabbit, then I follow 10 very specific steps. If I don't see a rabbit, then I follow an entirely different set of 23 steps. This is an example of a(n)...
Improper Flow Paradox Loop **Fork Output
Some time after a new piece of developed software is completed and made available to end users, the development team (including the requisitioner) gets together to discuss how the project went. This meeting is referred to as... (Choose the best answer.)
Maintenance Post-Project Evaluation Retrospective **Post-Mortem Final Analysis
When your program runs and the user is prompted to input something, the user's input... (Choose the best answer.)
Must be text (not a number). Cannot be validated by the program. **Should be assigned to a variable. Should be part of a print statement. Will have a variable type that corresponds with what was entered (e.g., an integer if the user enters an integer).
Unlike a tuple, a Python list allows...
Referencing index values of various elements. **Appending additional items to it. Programming errors to be eliminated completely. Each element to be referenced using a for-loop.
Which of the following is NOT on the "client side" during an IT project's development?
Requisitioner Project Sponsor Users **Project Analyst
In the Python code shown below, assuming that tables and fields references are valid, what mistake, if any, is present? ix = 7 cursor.execute("SELECT * FROM Dogfood WHERE Qty > ix")
Should include quotes around ix in the query. Should include a percent sign and the number 7 within the parentheses. No mistake is present. **Should use %d instead of ix in the query.
Yolanda is designing a website. She has created, in Photoshop, a design that clearly depicts exactly what the website's homepage should look like. This design is commonly referred to as a...:
Sketch **Comp Example Wireframe Rough Draft
When using agile methodology, at the end of a ____ your team should produce a portion of your project for your client to (potentially) push into production.
Stakeholder Meeting **Sprint Waterfall Cliff
My process needs to do one thing if I see a rabbit, but do something else entirely if there are no rabbits to be seen. What symbol handles this situation?
Terminator **Decision Connector Input/Output Action
Which of the following, if true, would make it MORE LIKELY that Agile would be a better methodology to pursue rather than Waterfall?
The IT team has completed similar projects on many occasions. The project specification document is very thorough and clear. **The client has only a vague sense of what the software should do. The project is a very small one that won't take much time to complete.
When I tried to write Python code to run SELECT queries, it worked, but when I tried to use INSERT, I got an error back. Which of the following might have caused this? (Choose the best answer.)
The account I connected with did not include the correct password. The account I connected with does not have permission to read data from the database. The account I connected with does not have access to the cursor command. **The account I connected with doesn't have permission to make changes to the database.
When the query you wrote via your Python IDE causes an error in SQL Server...
The program will end without warning or explanation. The program will skip over the SQL portion and continue running. **You'll see details regarding the error in the console. SQL Server will tell you there was a "SQL Error", with no further details.
When an IT department develops a major new software system, they follow which one of the following?
The specific business case provided. **Systems Development Life-Cycle The Universal Software Development Handbook Enterprise Data Systems
A proper flowchart progresses in what direction(s)?
To the right and either up OR down (not both). Upward To the right only. **Down and to the right. Upward and to the right.
At a certain point in the flowchart, different next steps need to be taken depending on whether the sky is sunny vs. cloudy vs. rainy vs. full of burning sulfuric clouds (i.e., based on which of the four sky conditions are currently in effect, the process follows one of four wholly unique sets of steps). Which of the following would facilitate the flowchart moving off into the correct set of steps based on the sky condition?
Using one decision symbol with four different out-flows. Using four different decision symbols. **Using three different decision symbols. Using one decision symbol with three different connectors.
To validate user input against data included in the database... (Choose the best answer.)
You need to set up a valid ucmfr. Set up a while loop that continues until the user input matches the content outputted by the database. Use a for-loop to step through each of the user's inputs. **Compare the user's input to the value of cursor[0].
Assuming that the user's input is the word "giraffe", what would be the output of the following? stopcorrectingmyvars = input("How old are you? ") try: x = int(stopcorrectingmyvars) print("Your age: ", x) except: print (stopcorrectingmyvars, "is not a valid age.")
Your age: giraffe is not a valid age **is not a valid age Your age: giraffe
Consider the following code, then fill in the blanks based on the prompts provided. Note: a blank can represent any number of words, characters, and/or spaces. customers = ["Jan", "Scott","Cindy","Michael"] customers__1__ __2__ In the code above, what would need to go in Blank 1 and Blank 2 that would change customer Scott's name to be Sam?
[1] = "Sam"
If you wanted to write a conditional statement that would be true whenever the integer variables a and b have the same value, which of the following would work?
a is b **a == b a and b a equal to b a = b
Say you want to obtain an output of 10 using the code below. What should go in the place of <Answer> to obtain this output? gooficus = "troglodyte" print (<Answer>(gooficus))
count It is not possible to get an output of 10 replacing only <Answer>. **len index
If we wanted to output every element of the list named atrociousness, what word would you put in place of the placeholder marked <answer> in the code below? atrociousness = [1, 3, 5, 7, 11, 13, 17, 19] <answer> y in atrociousness: print (y)
find if given while **for
Given formats = ["slalom", "giant slalom", "super-g", "downhill"], if we wanted to add the value "ultra-downhill" to become the last element in formats, which of the following would accomplish that?
formats[5] = "ultra-downhill" add.formats("ultra-downhill") **formats.append("ultra-downhill") formats += "ultra-downhill"
What would be the output of the following? formats = ["slalom", "giant slalom", "super-g", "downhill"] for x in formats: if (x == "super-g"): print("this one") else: print("nope")
nope nope this one An error. **nope nope this one nope this one this one nope nope nope
Your program includes the following line: cursor.execute("SELECT dogfname, doglname, dogage, dogspeed FROM Dog") What code shown below would print (to the console) each line out output returned by the query?
print(cursor[0]) print(cursor) for x in cursor:print(cursor[x]) **for zog in cursor:print(zog) for x in cursor:print(x.cursor())
I have three variables: dog, cat, and chicken. I want to output the values of each of them. Which of the following (if entered on a single line as shown) would you expect to do so?
print(dog + cat + chicken) print ("dog cat chicken") print(dog cat chicken) **print(dog, cat, chicken)
What would be the output of the following? z = 30 if (z > 30): print ("z is very great") elif (z < 30): print ("z is not so great") else: print ("please re-check your z")
redyellowblue **please re-check your z No output would result. z is very great z is not so great
What would be the output of the following? m, n = "dog", "cat" x = m + "|" + n print ("x is:", x)
x is: dog, cat x is: "dog" | "cat" An error message **x is: dog|cat x is:, dog|cat No output