CS-043
What is the HTML escape code for the copyright symbol?
©
What query string will the above form submit to the server on the click of the submit button?
'username=poppy'
What happens when a class name is invoked?
A new object of the class is created. A new chunk of memory is occupied. A value is returned.
A tutorial covers which of the following aspects?
Introduction of the language. Uses lots of examples.
What's the point of having a master password in PyCharm?
It allows you to access multiple repositories, but requires you to remember only one password.
In the URL below, what does "/" mean?
It indicates folder structure.
Why is using Mozilla's Firefox, as opposed to another popular browser, advantageous when learning about and using tools for web development?
It is open-source.
The insert statement below is used on the database built in this lesson. Would an error occur if the code were executed? If an error would occur what would be the cause of the error? insert('table.txt', 'my key', 'my \t value')
No errors would occur.
What, if any, is syntactily wrong with the following code block of setting a cookie in a simple WSGI server?
On lines 5 through 7 the colon, (:), should be changed to a closing single quote, comma, and an opening single quote, (', ').
What will happen to a project in PyCharm if the project is not closed before the directory is deleted?
PyCharm still remembers the project even though the directory is gone. It becomes like a ghost to PyCharm.
The following are ways to find answers to programming questions. Order them from the option you should try first to the option you should try last.
Search official documentation Search responses in forums Post your question in a forum
What will the above form submit to the server on submit?
a query string of 'name=Ahmed&password=493Ibn3'
What could happen if someone did not use proper protocol when building a webpage?
The page could appear distorted. The page could return an error.
What does the 404 error response from a web server mean?
The path from the URL leads to a page that doesn't exist.
What is the purpose of the 'type' attribute in the <input> element?
The type attribute specifies the type of <input> element to display.
What is the purpose of the 'value' attribute in the <input> element?
The value attribute specifies the value of an <input> element.
What does VCS stand for?
Version Control System
While developing a web page, seeing the HTML of that page is very helpful. Which tools or functions could you use to look at the HTML code underlying the page?
View Page Source Inspect Element
Using cookies is taxing on the server because all the cookies have to constantly be saved to and retrieved from the server.
false
What will the print statement's output be? (print(v1==v2))
false
You can check out multiple copies of a project from the same repository.
false
You can make a server using a word instead of a port number to make it easy to remember.
false
If the server was initiated using the following code, httpd = wsgiref.simple_server.make_server('', 5555, application), how would you access the server from a web browser?
http://localhost:5555
When power is turned off, files on the ______ are lost.
internal memory/RAM/primary memory
"Safe Delete"
checks for code that references the file that is being deleted.
A web browser is an example of a _____.
client
Which initiates communication?
client
Do row break tags use closing tags?
no
Is the following url an example of using a query string? http://money.cnn.com/2016/11/17/technology/coding-jobs-game-silicon-valley-codefights/index.html
no
What happens when extra query strings are added to the end of the URL?
nothing
Select all correct responses. The open() function is used to ___________.
open existing files create new files
Databases based on text files are ___ than ones built on binary files.
slower
What needs to be included in the start_response command to make the page have HTML formatting?
start_response('200 OK', [('Content-Type', 'text/html; charset=utf-8')])
Something within a set of angle brackets, such as <title>, is called a _______.
tag
In the following URL, what is the path? http://money.cnn.com/technology/gadgets?iid=tech_gadgets_nav
technology/gadgets
Which of the following file types can Python read/write?
text & binary
Which type of link could a news agency use for their home page and still maintain an appropriate amount of privacy?
either
Which type of link could a university use for their home page and still maintain an appropriate amount of privacy?
either
What is the purpose of a database? Select all that apply.
to store and retrieve information reliably and efficiently. to give application programmers access to advanced storage technologies without having to be experts themselves.
The function split() is used to divide a text string into parts based on a delimiter character.
true
How many query string parameters can be added onto a URL?
unlimited
Using an ASCII table, what is the decimal ASCII code for ampersand?
38
What is the point of the triple apostrophe (''') when creating HTML pages in python?
lets you enter a multi-line string of code
Python will report an error here since the class name does not start with a capital letter.
false
Which of the following storage capacities is the biggest?
12 PB
How many arguments are passed into the method below? Users.execute('INSERT INTO products VALUES (?, ?, ?, ?)', ['Jean', 'Picard', 8433521, 'Active'])
2
Python has a built-in class called object. It becomes the parent of every class that does not explicitly specify a parent. How many objects are created by this code? >>> a = object() >>> b = object() >>> c = object >>> d = a
2
Which of these numbers can be stored in a byte?
225, 116 (A byte can only store a whole number between 0 and 255.)
How many different header levels can you have?
6
What is the correct tag for an image in HTML?
<img>
Say you wanted to pass the value "hs" into the parameter "school" in the URL below. How would you modify the URL to accomplish this? Do not include any spaces.
?school=hs
In which of the following contexts would it be appropriate for the same key to appear multiple times? Select all that apply.
A table of hours logged by employees where the key is an employee's name. A table of purchases from a store where the key is a customer's name.
What does API mean?
Application Programming Interface
Which of these are good arguments for object-oriented programming?
By using inheritance, successively more complex classes can be created by adding functions and attributes to simpler classes. This saves having to reinvent code. It can bundle data (attributes) with the functions that apply to them in neat logical bundles called objects.
Which of the following is true about cookies?
Cookies help you regulate user sessions across different pages.
Calling a class twice does what?
Creates two distinct objects.
How much memory is available for object creation in Python?
Enough not to have to worry about for this course
What is the difference between Git and Github?
Git is a VCS and Github is a server
Which type of link could your bank use for the login screen to your accounts and still maintain an appropriate amount of privacy?
HTTPS
Which type of link could a company use for their employee login page and still maintain an appropriate amount of privacy?
HTTPs
What does HTTP stand for?
Hypertext Transfer Protocol
Which of these statements about object initialization are correct?
If the programmer writes the class function __init__(), then Python will call it after an object has been created to initialize object attributes. The number of arguments to the __init__() function must be one larger than the number of attributes to be initialized.
Which of the following shows the correct date format when setting a persistent cookie?
Mon, 25 Dec 2017 00:15:48 GMT
What will happen when the following code is executed? >>> x = A() >>> y = 1 >>> doubleObjectValue(x) >>> doubleValue(y) >>> print (x, y)
Output 2, 1
Which of the following are true regarding working directory?
Programs can change the working directory.
What is the difference between a 'text' input type and 'password' input type?
The 'password' conceals the characters typed into it.
What is the purpose of the 'action' attribute in the form element?
The action attribute specifies where to send the form-data when a form is submitted.
Suppose you had a class, Shape, which had a function to calculate the area. You then create a subclass of Shape, Circle. You create an instance of the Circle class, and call the area function. Which function will be called?
The area function defined in the Shape class
What happens when a hyperlink of <a href="document.html">Title</a> is clicked?
The browser will look in the current folder for "document.html".
What will happen if we try to print parameters in the code below? >>>import urllib.parse >>> parameters = urllib.parse.parse_qs('date=2016-06-26&date=2016-07-31&city=New York') >>> print(parameter)
The code will print {'date': ['2016-06-26', '2016-07-31'], 'city': ['New York']}.
Animals.execute('INSERT INTO products VALUES ('Toucan','Bird','Mexica,Central America,and South America','Ramphastidae')')
The code will work, but this is not the best way to use the .execute method.
What happens to the data that is in the write() buffer when the program crashes before close()?
The data is forever lost.
What is the purpose of the 'name' attribute in the <input> element?
The name attribute specifies the name of an <input> element.
What will happen if a space character is included in the value of a parameter for a URL (e.g. https://homesite.com?par1=value 1)?
The space is encoded as <code>%20</code>.
What is the purpose of the __repr__ method?
To customize the string representation of class objects
Imagine you set a cookie using the following snippet of code: Headers = [('Content-Type', 'text/plain; charset=utf-8'), ('Set-Cookie', 'name=Ahmed')] When will the cookie 'name' expire?
Whenever you close the browser session.
When will the cookie 'age' expire?
Whenever you close the browser session. (age expired already)
What are the advantages of using an "open-source" tool?
You can look at the code yourself without relying on an API.
Refactoring is _______.
a general term for renaming or restructuring code in a way that does not alter its functionality
Github is just for checking out copies of a project multiple people are working on.
false
not built in functions
dirname() array() datetime() pycharm() numpy()
The readline() is used to read a text file line by line. When the whole file has been read readline() will return ___________.
empty string
When string values are printed interactively without the print function, special characters such as the newline or tab character are printed as two characters, where the first one is a backslash. For example:
escaped
A simple way to print the contents of a file in one go is to simply print the file object.
false
What type of memory is not directly connected to the processor but is instead connected through wires?
external memory
What is UTF-8?
file encoding of Unicode
How many columns are present in the database that the code below creates? Users.execute('CREATE TABLE users (first name, last name, login, password, email)')
five
Below is a request to access an HTML page in Python. Complete the blanks with the appropriate components so that the code will execute correctly.
import socketrequest = 'GET /cs043/minimal.html HTTP/1.1 \r\nHost: 192.241.213.82 \r\n\r\n'sock = socket.create_connection(('192.241.213.82',
The code below will return an error. What do you need to add in order to make it execute properly?
import sqlite3 before line 1
built in functions
min() len() max() asci() open() Print()
How many objects can one class create?
more than you'll ever need
Identify which of the following are classes, objects, data attributes, methods, and class functions.
object.function() = method function()= class functions object.variable = data attribute
Which of the following are part of the core language?
return() if() for() import()
All of the following are useful tools in web development except _______. inspecting page element viewing page info viewing page source
running the capacitor
What line of code should replace the question marks to correctly call the __init__ function of Sandwich from the __init__ function of its subclass Turkey?
super().__init__(bread_type)
When you don't specify the right encoding for your page, _______.
the computer will have to guess, which could make your page incomprehensible
Forms can only have input elements within their opening and closing tags.
true
Forums are a good resource for getting help.
true
PyCharm is one of many good IDEs.
true
Python comes with a DB-API that is better than our simple database.
true