SI 364 Midterm
What CSS selector would style a tag that looks like this: < ... class="puppy"> _puppy { ... %puppy { ... puppy !important { ... puppy { ... .puppy { ...
.puppy { ...
Which command do you use to exit the SQLite comand line tool? .quit return quit() grep
.quit
In Python, what is the difference between an open file and a socket? The a program writes to a socket, it can read its data back after closing the socket The program can rewind a socket and start writing again at the beginning of the socket When you open a file you get a read and write handle to allow simultaneous operations A socket can be simultaneously read and written
A socket can be simultaneously read and written
What is the purpose of the *next* parameter on a login or logout URL? It advances the iteration variable in a for loop It indicates which record to start with in a list that exceeds the length of the page It tells the authentication system where to go after the action is complete It moves to the next item in a linked list
It tells the authentication system where to go after the action is complete
DBA stands for [_____]
database administrator
These questions come from the Django project tutorial materials. What is the default database backend for Django projects when they are first set up. MongoDB MySQL Oracle PostgreSQL sqlite3
sqlite3
What must happen before a client can open a socket? A server must be running that is listening for socket connections The client must be on the same system as the server The client must be in the same folder as the server The client must create a local file with the same name as the socket The server must allocate sufficient memory to handle any needed retransmissions
A server must be running that is listening for socket connections
What is the purpose of the admin site in a Django project? A site the checks to see if your server is using too many resources A site that tracks user activity A site that makes sure all of the software is always the latest version A site that lets you add, change, and delete data items
A site that lets you add, change, and delete data items
What can you do in the Django Shell that you can't do in the Python Shell? Use the print() function check the syntax of a Python command Access a Django model write a for loop
Access a Django model
What is the purpose of encode() in the socket1.py code: To check if there is any data ready to send To break the data into packets for network transmission To make sure that the we server properly recognizes the GET verb To convert the data to UTF-8 before sending
To convert the data to UTF-8 before sending
What is the purpose of the models.py file? To apply a regular expression to the incoming path in the request oobect To make building views for your application simpler To connect your database to the Django addministration interface To define the shape of the data objects to be stored in a database
To define the shape of the data objects to be stored in a database
In the mysite/urls.py file, what is the basic idea of "include"? To pull in commonly used HTML material To apply a regular expression to the incoming path in the request oobect To properly install django and all its dependencies To make it easy to plug-and-play URLs
To make it easy to plug-and-play URLs
What does the second "T" of HTTP stand for? Transpose Transport Transfer movemenT
Transfer
Which of the following is not a way to include CSS in an HTML page? Using the <style> tag inline in the HTML document External Style Sheet Using the <font> tag to enclose other tags Directly on an HTML tag using the style= attribute
Using the <font> tag to enclose other tags
What organization is responsibile for standards for HTML and the web. CERN NCSA Unesco HTMLco.com World Wide Web Consortium
World Wide Web Consortium
What does it mean when you see the "..." command in the command line interface? Python is waiting for a semicolon You can enter more than one Linux command to be executed simultaneously You are writing a multi-line Python statement You have switched from Python to SQL
You are writing a multi-line Python statement
What does the "b" in "bash shell" stand for? Best Bourne Conch Bivalve Bond (James Bond)
Bourne
What does the "python manage.py migrate" command do? Moves the application to a new server Moves login sessions to the backing store Builds/updates the database structure for the project Makes a backup copy of db.sqlite3
Builds/updates the database structure for the project
Which of the HTTP headers does the browser look at to decide how to display the retrieved document? Format Location Content-type Content-length ETAG Display-type
Content-type
What do you put at the beginning of an HTML file to inform the browser which variant of HTML you will be using in this document? <?xml version> <body> <html> <meta type> <xs:sequence> DOCTYPE
DOCTYPE
Which of the following is *not* a benefit of using the Django forms capability? You can add complex form validation rules to your application You reduce the amount of HTML you need to generate You can have a mapping layer between your models and templates You can easily create attractively styled forms Database portability
Database portability
In the bash shell, what is the tab used for? Scolling up and down in commands you previously typed File and folder completion Logging out Scrolling up and down while reading an online manual page
File and folder compression
When a browser connects to a web server to retrieve a document, what command is sent to the server? POST DELE PUT GET
GET
The Linux command to search files for a particular string is "grep". What does "grep" stand for? GReat Expression Printer Global Regular Expression Print Go Research Explore Print General Regular Expression Parser
Global Regular Expression Print
What is the topic of the Internet Engineering Task Force document RFC2616? SMTP - Simple Mail Transfer Protocol POP - Post Office Protocol HTTP - HyperText Transfer Protocol Message Data Types FTP - File Transfer Protocol
HTTP - HyperText Transfer Protocol
What standards organization publishes many of the documents that describe the protocols we use on the Internet? IETF 6-Sigma RIA Educause IRR
IETF
Which HTML tag typically generates a request to retrieve a document form the server when it is clicked? b div img a h1 p
a
What file in a Django application do you edit to make sure a model appears in the admin interface? module.py views.py sakaiger.py admin.py
admin.py
In HTML, what attribute is used to indicate text that will be shown if an image is not loaded or read to a user that is using a screen reader? [_____]
alt
Which best describes the Django functionality that puts up the login form? TemplateTag Middleware Application Model
application
In the sample server.py code, which function call will fail if another application is already using a port? socket() bind() recv() listen() decode(
bind()
What is the django command to reset the password for the admin user? shell runserver changepassword check
changepassword
Which came first? Cookie Session Login
cookie
What is the django command to create a user/password for the admin user interface? createsuperuser MOVE CORRESPONDING INTO USER //SYSIN DD USER INSERT INTO User;
createsuperuser
What is the preferred tag in modern HTML to indicate that text is to be shown in italics format? i span italics <xs:italics> em
em
A primary key can be set to null.
false
Images, PDF, movies cannot be stored in a database.
false
Which of these CSS rules make text appear in a bold face font? font-weight: bold font-style: bold strong: yes font-bold: on font-expand: 10%
font-weight: bold
Primary keys are used to distinguish rows within in a table. [_____] keys are used to reference the primary key from a different table.
foreign
How to you indicate that you want to display a form using the Crispy library in a template? form.as_crispy form.as_table form|crispy csrf_token
form|crispy
What utility method simplifies the code needed to load the old model data when processing an update request? render_to_template_with_check() get_object_or_404() contitional_render_404() load_try_except()
get_object_or_404()
Which CSS selector controls how a link (anchor tag) looks while the user mouses over the link (i.e. while hovering)? [_____]
hover
Which is the correct ordering of opening tags in a well formed html document? h1 body title head html body html h1 head title title head html body h1 html head title body h1
html head title body h1
What is the HTML tag for an item in a bulletted list? li item list:item bullet tag
li
What tag is used to import a style sheet into an HTML document? [_____]
link
In the sample server.py code, which function call actually waits for incoming socket connection requests? bind() socket() recv() listen() decode()
listen()
Which best describes the Django functionality that supports sessions? Model TemplateTag Application Middleware
middleware
Which of the following Django commands actually modify the database schema? migrate updateschema runserver check makemigrations
migrate
Which of the following CSS selectors is between the content area and the border? (CSS box model) edge perimeter pixels margin padding
padding
These questions come from the Django project tutorial materials. What is the name of the application we build in step 1 of "Writing your first Django app, part 1"? polls dogs cats autos blog
polls
In what method in a view class would you expect to see "form.save()" to save data from an incoming form? get_queryset() post() dispatch() get()
post()
What command do we run on PythonAnywhere instead of "python manage.py runserver"? python startapp polls python manage.py paw_restart python manage.py migrate - and then set the virtual environment python manage.py check - and then reload the web application
python manage.py check - and then reload the web application
What command is used to add a new application to a Django project? python manage.py startapp python manage.py create python manage.py build python manage.py new
python manage.py startapp
Which command do you use to exit the Django Shell? grep quit() return .quit
quit()
Which of the following commands will exit the Python Shell? grep quit() .quit return
quit()
What is the default name of the emplate that Django will load when presenting the user with a login screen? home/login.html autos/login.html auth/auth.html registration/login.html
registration/login.html
What variable do you check in a Django view to see if this request is from a logged in user? request.user.is_authenticated is_authenticated.view request.authenticated request.user.auth
request.user.is_authenticated
Which of these is a reserved word in the SQL (database) language? print grep return select
select
What character is the SQLite command line tool looking for when you see the '...>' prompt? pound sign semicolon asterisk period
semicolon
Which came second? Login Session Cookie
session
What file contains the list of INSTALLED_APPS in a Django project? urls.py apps.py settings.py views.py manage.py
settings.py
Which HTML tag does nothing to the text it surrounds and has as its sole purpose to create a "handle" so as to be able to apply CSS to the text. [_____]
span
What is the preferred tag in modern HTML to indicate that text is to be shown in bold format? b strong <xs:bold> span bold
strong
What is the tag that is used in a document's <head> area to set the text shown in the tab of the browser or title bar? [_____]
title
"INSERT INTO" is the keyword used to insert data into tables.
true
The LIMIT clause helps to narrow down the number of rows returned by the query.
true
Which of the Python libraries makes it very easy to make HTTP requests from Python? decode json urllib re
urllib
What is the value in a Django template to print out the current logged in user's email address? user.email user.rmail user.address user.info.address.email
user.email
What CSS rule allows you include a tag in markup but hide it from view in the browser? right: 0; visibility: hidden; status: off; font-size: -1px; display: block;
visibility: hidden;
Which keyword is used to add conditions to your query?
where
Which of these commands must be typed when you start a new shell to activate your virtual environment to make sure you have the correct versions of Python and Django. cd ls workon django4 grep
workon django4
What is the most commonly used operating system for production servers in the cloud. Linux MacOS MS/DOS DEC VMS Windows
Linux
What operating system are you using in PythonAnywhere when you open a Bash shell? MS/DOS Windows Linux DEC VMS MacOS
Linux
Which command prompt generally ends in dollar sign ($)? Linux shell Django shell Python shell SQLite interface
Linux shell
What Django class does a class-based view need to extend to indicate that the view can only be accessed by logged in users? AutoRedirectView LoginRequiredMixin MustLoginView AutoLoginView
LoginRequiredMixin
What is the topic of the Internet Engineering Task Force document RFC42? Message Data Types HTTP - HyperText Transfer Protocol POP - Post Office Protocol FTP - File Transfer Protocol SMTP - Simple Mail Transfer Protocol
Message Data Types
Which keyword will cause the results of the query to be displayed in sorted order?
ORDER BY
Which of the following is NOT part of a Uniform Resource Locator: Host Document Protocol Operating System
Operating System
Which command prompt uses three chevrons (>>>)? Python shell Linux shell SQLite interface Mongo shell
Python shell
Which of these Internet Engineering Task Force (IETF) documents described the "Internet Control Message Protocol"? RFC5325 RFC1224 RFC792 RFC815
RFC792
Which command is used to retrieve all records from the table?
SELECT * FROM Users
In the bash shell, what are the arrow keys used for? Logging out Scrolling up and down while reading an online manual page Scolling up and down in commands you previously typed File and folder completion
Scolling up and down in commands you previously typed
What string is returned by: x = django.urls.reverse('login') in dj4e-samples? nigol /dj4e-samples/login /accounts/login /login
/accounts/login
Structured Query Language (SQL) is used to (check all that apply) Create a table Delete data Run python Insert data
1,2,4
What port is used for Simple Mail Transfer Protocol (SMTP)? 25 420 142 80 119
25
Which of the following statements are true? A tag can only have a "class" attribute or an "id" attribute but not both A "class" attribute can only be used once in an HTML file An "id" attribute should only be used once in an HTML file A "class" attribute can be used many times in an HTML file It is recommended to use an "id" attribute many times in an HTML file
3,4
What port is used by default for Secure HTTP (https)? 80 25 443 142 119
443
When a browser connects to a web server to retrieve a document, what is the default TCP/IP port that is used? 119 142 25 420 80
80
What is the start of an HTML comment? <!-- /* ''' #
<!--
What does the fields="__all__" statement do in the Meta section of a Django form class? Indicates that all of the underlying model fields should be in the form Indicates that the owner field is not supposed to be shown to the user when the form is displayed Indicates that none of the model fields are to be saved
Indicates that all of the underlying model fields should be in the form
What happens when the user passes a login check? A new record is added to the auth_user table A cookie is set Information is added to the session A new record is asses to the auth_group table
Information is added to the session
For the following HTML, which description of the "style=" attribute is most accurate? <p style="color: red;"> It changes the background color of the paragraph to red It changes the color of the tab for this page in the browser to be red It allows the application of the specified CSS rule to the content of the paragraph It is an HTML syntax error and will be ignored It contains JavaScript to be executed when the user's mouse hovers over the paragraph
It allows the application of the specified CSS rule to the content of the paragraph
What does the "sqlmigrate" option accomplish in a Django application? It lets you see the SQL that will run to effect a migration It moves all of your non-SQL data into flat files It copys all of your SQL in to a REST based API It builds/updates the database structure for the project
It lets you see the SQL that will run to effect a migration
What does the __str__ method in a Django model accomplish? It determines how the model will respond to stress It lets you specfiy how an instance of the model will be represented as a string It indicates how strict the storage model will be in terms of column length It improves the strength of the binding between SQL and the model
It lets you specfiy how an instance of the model will be represented as a string
What is the difference between the Django shell and a normal interactive Python shell? Only the Python shell can print values You can run Django commands in a Python shell The Django shell uses Javascript instead of Python The Django shell loads all of the project objects before starting
The Django shell loads all of the project objects before starting
In a Django template, what is stored in the request.path variable? A list of breadcrumbs of recently visited URLs A string indicating the path to the 'parent' folder The URL of the currently executing request It indicates the actual table name of the model that is currently in use
The URL of the currently executing request
What can't you see in the Browser Developer Mode for most browsers? The HTTP response code (like 200 or 404) for each request The request and response headers for retrieved documents The browser Document Object Model (DOM) The code that runs in the server
The code that runs in the server
What happens when a Create form is submitted and Django forms detects a validation error? The form is re-displayed with the error messages The form is re-displayed with the incorrect data A 403 (Not authorized) is send back to the browser The form is re-displayed with the incorrect data and error messages The record is deleted form the databas
The form is re-displayed with the incorrect data and error messages
What is true about the following HMTL? <a href="http://www.dr-chuck.com/page2.htm">Second Page</a> The HTML is improperly formed and there will be a syntax error The text "Second Page" is improperly placed and will not be seen The reference is a relative reference The reference is an absolute reference
The reference is an absolute reference
Why is there more than one font listed in the following CSS rule? body { font-family: "Trebuchet MS", Helvetica, Arial, sans-serif; } They are the preferred fonts for Windows, Mac, Linux, and "Other" systems They are listed in descending preference order if fonts are not present in the browser This is a syntax error, square braces [ ] should be used for the CSS rule This is a syntax error, the rule should start with "font-name"
They are listed in descending preference order if fonts are not present in the browser
