PRP201c

Ace your homework & exams now with Quizwiz!

What word does the following sequence of numbers represent in ASCII: 108, 105, 115, 116 A list B lost C open D fuss E http

A

What protocol does Twitter use to protect its API? A SOAP B OAuth C WS*Security D Java Web Tokens E SHA1-MD5 F PKI-HMAC

B

What word does the following sequence of numbers represent in ASCII: 108, 105, 115, 116 A dict B mist C first D list E webs

D

What must you do in Python before opening a socket? A import socket B open socket C import tcp-socket D _socket = true E import tcp

A

What will the following Python program print out? def fred(): print("Zap") def jane(): print("ABC") jane() fred() jane() A ABC Zap ABC B ABC Zap jane C Zap ABC Zap D Zap Zap Zap E Zap ABC jane fred jane

A

2.What is the ASCII character that is associated with the decimal value 42? A * B / C : D +

A

Given the following line of text: From [email protected] Sat Jan 5 09:14:16 2008 What would the regular expression '\S+?@\S+' match? A [email protected] B marquard@uct C From D \@\ F [email protected]

A

How is a Python socket different than a Python file handle? A You can read and write using the same socket B Opening a socket will never fail, while opening a file can fail C The socket does not read all of the data when it is opened

A

In a client-server application on the web using sockets, which must come up first? A server B client C it does not matter

A

In this Python code, which line actually reads the data? import socket mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mysock.connect(('data.pr4e.org', 80)) cmd = 'GET http://data.pr4e.org/romeo.txt HTTP/1.0\n\n'.encode() mysock.send(cmd) while True: data = mysock.recv(512) if (len(data) < 1): break print(data.decode()) mysock.close() A mysock.recv() B socket.socket() C mysock.close() D mysock.connect() E mysock.send()

A

In this Python code, which line is most like the open() call to read a file: import socket mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mysock.connect(('data.pr4e.org', 80)) cmd = 'GET http://data.pr4e.org/romeo.txt HTTP/1.0\n\n'.encode() mysock.send(cmd) while True: data = mysock.recv(512) if (len(data) < 1): break print(data.decode()) mysock.close() A mysock.connect() B import socket C mysock.recv() D mysock.send() E socket.socket()

A

The following Python code causes a traceback: 1 a = "123" 2 b = 456 3 c = a + b 4 print(c) Which line fails with a traceback? A 3 B 1 C 2 D 4

A

What does the LIMIT clause in the following SQL accomplish? SELECT org, count FROM Counts ORDER BY count DESC LIMIT 10 A It only retrieves the first 10 rows from the table B It only sorts on the first 10 characters of the column C It reverses the sort order if there are more than 10 rows D It avoids reading data from any table other than Counts

A

What does this SQL command do? SELECT COUNT(*) FROM Users Hint: This is not from the lecture A It counts the rows in the table Users B It adds a COUNT column to the Users table C It only retrieves the rows of Users if there are at least two rows D It is a syntax errror

A

What ends up in the "x" variable in the following code: html = urllib.request.urlopen(url).read() soup = BeautifulSoup(html, 'html.parser') x = soup('a') A A list of all the anchor tags (<a..) in the HTML from the URL B True if there were any anchor tags in the HTML from the URL C All of the externally linked CSS files in the HTML from the URL D All of the paragraphs of the HTML from the URL

A

What is "self" typically used in a Python method within a class? A To refer to the instance in which the method is being called B The number of parameters to the method C To terminate a loop D To set the residual value in an expression where the method is used

A

What is the difference between the "+" and "*" character in regular expressions? A The "+" matches at least one character and the "*" matches zero or more characters B The "+" matches upper case characters and the "*" matches lowercase characters C The "+" matches the beginning of a line and the "*" matches the end of a line D The "+" matches the actual plus character and the "*" matches any character E The "+" indicates "start of extraction" and the "*" indicates the "end of extraction"

A

What is the label we give to a column that is an integer and used to point to a row in a different table? A Foreign key B Primary key C Local key D Remote key E Logical key

A

What is the method to cause Python to parse XML that is stored in a string? A fromstring() B parse() C readall() D extract() E xpath()

A

What is the most common Unicode encoding when moving data between systems? A UTF-8 B UTF-128 C UTF-32 D UTF-16 E UTF-64

A

What is the most common Unicode encoding when moving data between systems? A UTF-8 B UTF-32 C UTF-64 D UTF-16 E UTF-128

A

What is the purpose of "OR IGNORE" in the following SQL: INSERT OR IGNORE INTO Course (title) VALUES ( ? ) A It makes sure that if a particular title is already in the table, there are no duplicate rows inserted B It ignores errors in the SQL syntax for the statement C It updates the created_at value if the title already exists in the table D It ignores any foreign key constraint errors

A

When reading data across the network (i.e. from a URL) in Python 3, what method must be used to convert it to the internal format used by strings? A decode() B encode() C upper() D trim() E find()

A

When you are doing a SELECT with a JOIN across multiple tables with identical column names, how do you distinguish the column names? A tablename.columnname B tablename['columnname'] C tablename->columnname D tablename/columnname

A

When you click on an anchor tag in a web page like below, what HTTP request is sent to the server? <p>Please click <a href="page1.htm">here</a>.</p> A GET B POST C PUT D DELETE E INFO

A

Which command is used to retrieve all records from a table? A SELECT * FROM Users B RETRIEVE all FROM User C RETRIEVE * FROM Users D SELECT all FROM Users

A

Which of the following is most like an open socket in an application? A An "in-progress" phone conversation B Fiber optic cables C The wheels on an automobile D The chain on a bicycle E The ringer on a telephone

A

Which of the following is true about an API? A An API is a contract that defines how to use a software library B An API defines the header bits in the first 8 bits of all IP packets C An API keeps servers running even when the power is off D An API defines the pin-outs for the USB connectors

A

Which of the following lines of Python code contains a syntax error? 1 x = 12 2 if x < 5: 3 print("smaller") 4 else: 5 print("bigger") 6 print("all done") A 3 B 1 C 5 D2

A

Which of the following lines will never print out regardless of the value for x? if x < 2 : print("Below 2") elif x < 20 : print("Below 20") elif x < 10 : print("Below 10") else : print("Something else") A Below 10 B Below 20 C Something else D Below 2

A

Which of the following regular expressions would extract the URL from this line of HTML: <p>Please click <a href="http://www.dr-chuck.com">here</a></p> A href="(.+)" B href=".+" C http://.* D <.*>

A

Which of these two web service approaches is preferred in most modern service-oriented applications? A REST - Representational state transfer B SOAP - Simple Object Access Protocol

A

Which organization publishes Internet Protocol Standards? A IETF B LDAP C SIFA D SCORM E IMS

A

In the following XML, which are attributes? (Choose 2) <person> <name>Chuck</name> <phone type="intl"> +1 734 303 4456 </phone> <email hide="yes" /> </person> A hide B email C type D person E name

A, C

Structured Query Language (SQL) is used to (check all that apply) A Delete data B Check Python code for errors C Create a table D Insert data

A, C, D

For the following Python code to work, what must be added to the title column in the CREATE TABLE statement for the Course table: cur.execute('''INSERT OR IGNORE INTO Course (title) VALUES ( ? )''', ( title, ) ) cur.execute('SELECT id FROM Course WHERE title = ? ', (title, )) course_id = cur.fetchone()[0] A A NOT NULL constraint B A UNIQUE constraint C A PRIMARY KEY indication D An AUTOINCREMENT indication

B

How are strings stored internally in Python 3? A EBCDIC B Unicode C ASCII D Latin E UTF-16

B

How are strings stored internally in Python 3? A bubble memory B Unicode C UTF-16 D inverted E EBCDIC

B

If our user interface (i.e., like iTunes) has repeated strings on one column of the user interface, how should we model this properly in a database? A Put the string in the first row where it occurs and then put that row number in the column of all of the rest of the rows where the string occurs B Make a table that maps the strings in the column to numbers and then use those numbers in the column C Encode the entire row as JSON and store it in a TEXT column in the database D Put the string in the last row where it occurs and put the number of that row in the column of all of the rest of the rows where the string occurs E Put the string in the first row where it occurs and then put NULL in all of the other rows

B

In the following XML, which node is the parent node of node e <a> <b>X</b> <c> <d>Y</d> <e>Z</e> </c> </a> A a B c C b D e

B

What happens if a DELETE command is run on a table without a WHERE clause? A All the rows without a primary key will be deleted B All the rows in the table are deleted C It is a syntax error D The first row of the table will be deleted

B

What is an important aspect of an Application Layer protocol like HTTP? A How much memory does the server need to serve requests? B Which application talks first? The client or server? C How long do we wait before packets are retransmitted? D What is the IP address for a domain like www.dr-chuck.com?

B

What is the "wild card" character in a regular expression (i.e., the character that matches any character)? A + B . C * D $ E ^ G ?

B

What is the ASCII character that is associated with the decimal value 42? A ! B * C + D ^ E /

B

What is the decimal (Base-10) numeric value for the upper case letter "G" in the ASCII character set? A 17 B 71 C 7 D 256 E 142

B

What is the most common Unicode encoding when moving data between systems? A UTF-64 B UTF-8 C UTF-128 D UTF-32 E UTF-16

B

What is the purpose of the BeautifulSoup Python library? A It allows a web site to choose an attractive skin B It repairs and parses HTML to make it easier for a program to understand C It animates web operations to make them more attractive D It optimizes files that are retrieved many times E It builds word clouds from web pages

B

What is the type of the return value of the re.findall() method? A A boolean B A list of strings C A string D An integer E A single character

B

What library call do you make to append properly encoded parameters to the end of a URL like the following: http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=Ann+Arbor%2C+MI A re.match() B urllib.parse.urlencode() C urllib.urlcat() D re.encode()

B

What method do you call in an SQLIte cursor object in Python to run an SQL command? A run() B execute() C socket() D send()

B

When reading data across the network (i.e. from a URL) in Python 3, what method must be used to convert it to the internal format used by strings? A internal() B decode() C rstrip() D split() E encode()

B

Which keyword will cause the results of the query to be displayed in sorted order? A GROUP BY B ORDER BY C WHERE D None of these

B

Which of the following dates is in ISO8601 format? A 2002-May-30 B 2002-05-30T09:30:10Z C 05/30/2002 D May 30, 2002

B

Which of the following is NOT a good rule to follow when developing a database model? A Model each "object" in the application as one or more tables B Use a person's email address as their primary key C Never repeat string data in more than one table in a data model D Use integers as primary keys

B

Which of the following is not true about the service-oriented approach? A Standards are developed where many pairs of applications must work together B An application runs together all in one place C An application makes use of the services provided by other applications D Web services and APIs are used to transfer data between applications

B

Which of the following regular expressions would extract 'uct.ac.za' from this string using re.findall? From [email protected] Sat Jan 5 09:14:16 2008 A ..@\S+.. B @(\S+) C @\S+ D F.+:

B

Which programming language serves as the basis for the JSON syntax? A Python B JavaScript C SCALA D Java E PHP

B

Who is credited with the REST approach to web services? A Vint Cerf B Roy Fielding C Bjarne Stroustrup D Daphne Koller E Leonard Klienrock

B

In this XML, which are the "complex elements"? (Choose) <people> <person> <name>Chuck</name> <phone>303 4456</phone> </person> <person> <name>Noah</name> <phone>622 7421</phone> </person> </people> A phone B person C people D name E Noah

B, C

In database terminology, another word for table is A attribute B row C relation D field

C

In the following SQL, cur.execute('SELECT count FROM Counts WHERE org = ? ', (org, )) what is the purpose of the "?"? A It allows more than one boolean operation in the WHERE clause B It is a syntax error C It is a placeholder for the contents of the "org" variable D It is a search wildcard

C

In the following XML, what is "type"? <person> <name>Chuck</name> <phone type="intl"> +1 734 303 4456 </phone> <email hide="yes" /> </person> A XML syntax error B Value C An attribute D Complex element E Simple element F Tag

C

In the following example, an error occurs in "line3" that normally causes a traceback if it were not in a try/except. line1 try: line2 line3 line4 except: line5 line6 What is the sequence of lines executed in this program? A line1, line2, line3, line4, line5, line6 B line1, line5, line6 C line1, line2, line3, line5, line6 D line1, line4, line5, line6 E line1, line2, line3, line6

C

What SQLite keyword is added to primary keys in a CREATE TABLE statement to indicate that the database is to provide a value for the column when records are inserted? A ASSERT_UNIQUE B INSERT_AUTO_PROVIDE C AUTOINCREMENT D AUTO_INCREMENT

C

What does the "H" of HTTP stand for? A Hyperspeed B wHolsitic C HyperText D Simple E Manual

C

What does the executescript() method in the Python SQLite cursor object do that the normal execute() method does not do? A It allows embedded JavaScript to be executed B It allows embeded Python to be executed C It allows multiple SQL statements separated by semicolons D It allows database tables to be created

C

What does the following Python code print out? stuff = ['joseph', 'sally', 'walter', 'tim'] print(stuff[2]) A joseph B tim C walter D sally

C

What happens when you JOIN two tables together without an ON clause? A You get all of the rows of the left table in the JOIN and NULLs in all of the columns of the right table B You get no rows at all C The number of rows you get is the number of rows in the first table times the number of rows in the second table D Leaving out the ON clause when joining two tables in SQLite is a syntax error E The rows of the left table are connected to the rows in the right table when their primary key matches

C

What is "serialization" when we are talking about web services? A Sorting all the data stored in a tuple B Making it so that dictionaries can maintain their keys in sorted order C The act of taking data stored in a program and formatting it so it can be sent across the network D Marking each network packet so it can be put back into order on the receiving system

C

What is the SQL keyword that reconnects rows that have foreign keys with the corresponding data in the table that the foreign key points to? A CONSTRAINT B CONNECT C JOIN D COUNT E APPEND

C

What is the primary added value of relational databases over flat files? A Ability to store data in a format that can be sent across a network B Ability to execute Python code within the file C Ability to scan large amounts of data quickly D Ability to execute JavaScript in the file E Ability to quickly convert data to HTML

C

What is the purpose of a primary key? A To look up a row based on a string that comes from outside the program B To point to a particular row in another table C To look up a particular row in a table very quickly D To track the number of duplicate values in another column

C

What word does the following sequence of numbers represent in ASCII: 108, 105, 110, 101 A tree B func C line D lost E ping

C

What would the following Python code print out? abc = "With three words" stuff = abc.split() print(len(stuff)) A 16 B 2 C 3 D 1 E 14

C

Where in the computer is a variable such as "X" stored? x = 123 A Input Devices B Secondary Memory C Main Memory D Output Devices E Central processing unit

C

Which HTTP header tells the browser the kind of document that is being returned? A HTML-Document: B Metadata: C Content-Type: D Document-Type: E ETag:

C

Which of the following Python data structures is most similar to the value returned in this line of Python: x = urllib.request.urlopen('http://data.pr4e.org/romeo.txt') A regular expression B list C file handle D socket E dictionary

C

Which of the following lines will never print out regardless of the value of "x"? if x < 2 : print("Below 2") elif x < 0 : print("Negative") else : print("Something else") A Below 2 B All the lines will print out C Negative D Something else

C

Which of these is the right syntax to make a new table? A MAKE DATASET people; B CREATE people; C CREATE TABLE people; D MAKE people;

C

How are strings stored internally in Python 3? A Byte Code B ASCII C UTF-8 D Unicode E EBCDIC

D

How do we model a many-to-many relationship between two database tables? A We use a BLOB column in both tables B We add 10 foreign keys to each table with names like artict_id_1, artist_id2, etc. C We use the ARRAY column type in both of the tables D We add a table with two foreign keys

D

In Python, what is a database "cursor" most like? A A Python dictionary B A method within a class C A function D A file handle

D

In a typical online production environment, who has direct access to the production database? A Project Manager B Developer C UI/UX Designer D Database Administrator

D

In the following Python code sequence (assuming cur is a SQLite cursor object), cur.execute('SELECT count FROM Counts WHERE org = ? ', (org, )) row = cur.fetchone() what is the value in row if no rows match the WHERE clause? A An empty list B -1 C An empty dictionary D None

D

What are the three parts of this URL (Uniform Resource Locator)? http://www.dr-chuck.com/page1.htm A Protocol, document, and offset B Page, offset, and count C Document, page, and protocol D Protocol, host, and document E Host, offset, and page

D

What character do you add to the "+" or "*" to indicate that the match is to be done in a non-greedy manner? A ++ B \g C $ D ? E ^ F **

D

What do we call it when a browser uses the HTTP protocol to load a file or page from a server and display it in the browser? A DECNET B SMTP C IMAP D The Request/Response Cycle E Internet Protocol (IP)

D

What does the "[0-9]+" match in a regular expression? A Any number of digits at the beginning of a line Several digits followed by a plus sign B Any mathematical expression C Zero or more digits D One or more digits

D

What does the following Python sequence print out? x = 'From: Using the : character' y = re.findall('^F.+:', x) print(y) A ['From:'] B : C From: D ['From: Using the :'] E ^F.+:

D

What happens when you exceed the Google geocoding API rate limit? A The API starts to perform very slowly B You canot use the API until you respond to an email that contains a C survey question D You cannot use the API for 24 hours E Your application starts to perform very slowly

D

What header does Twitter use to tell you how many more API requests you can make before you will be rate limited? A content-type B x-request-count-down C x-max-requests D x-rate-limit-remaining

D

What is a good time zone to use when computers are exchanging data over APIs? A The local time zone of the sending computer without daylight savings time B The local time zone of the sending computer C The local time zone of the receiving computer D Universal Time / GMT

D

What is the method used to parse a string containing JSON data so that you can work with the data in Python? A json.connect() B json.read() C json.parse() D json.loads()

D

What is the purpose of XML Schema? A A Python program to tranform XML files B To transfer XML data reliably during network outages C To compute SHA1 checksums on data to make sure it is not modified in transit D To establish a contract as to what is valid XML

D

What separates the HTTP headers from the body of the HTTP document? A X-End-Header: true B A less-than sign indicating the start of an HTML tag C Four dashes D A blank line

D

What should you check before scraping a web site? A That the web site only has links within the same site B That the web site supports the HTTP GET command C That the web site returns HTML for all pages D That the web site allows scraping

D

What will the following Python program print out? total = 0 for abc in range(5): total = total + abc print(total) A 6 B 16 C 4 D 10 E 5

D

What will the following Python program print out? (This is a bit tricky so look carefully). def hello(): print("Hello") print("There") x = 10 x = x + 1 A Hello B There C 11 D Nothing will print E 11 F x = 11

D

What would the following mean in a regular expression? [a-z0-9] A Match anything but a lowercase letter or digit B Match an entire line as long as it is lowercase letters or digits C Match any number of lowercase letters followed by any number of digits D Match a lowercase letter or a digit E Match any text that is surrounded by square braces

D

Which SQL command is used to insert a new row into a table? A INSERT AFTER B ADD ROW C INSERT ROW D INSERT INTO

D

Which of the following commands would update a column named "name" in a table named "Users"? A Users->name = 'new name' WHERE ... B UPDATE Users (name) VALUES ('new name') WHERE ... C Users.name='new name' WHERE ... D UPDATE Users SET name='new name' WHERE ...

D

Which of the following is not a good synonym for "class" in Python? A template B pattern C blueprint D direction

D

For this XML Schema: <xs:complexType name="person"> <xs:sequence> <xs:element name="lastname" type="xs:string"/> <xs:element name="age" type="xs:integer"/> <xs:element name="dateborn" type="xs:date"/> </xs:sequence> </xs:complexType> And this XML, <person> <lastname>Severance</lastname> <Age>17</Age> <dateborn>2001-04-17</dateborn> </person> Which tag is incorrect? A age B dateborn C person D lastname E Age

E

Looking at the following XML, what text value would we find at path "/a/c/e" <a> <b>X</b> <c> <d>Y</d> <e>Z</e> </c> </a> A b B e C Y D a E Z

E

What is the decimal (Base-10) numeric value for the upper case letter "G" in the ASCII character set? A 2048 B 1771 C 17 D 7 E 71

E

What is the primary use of the Python dictionary? A To insure that all Python reserved words are properly spelled B To make sure that the definitions of the Python reserved words are C available in different languages (French, Spanish, etc) D To look up all of the methods which are available on a Python object E To store key / value pairs

E

What kind of variable will you get in Python when the following JSON is parsed: { "id" : "001", "x" : "2", "name" : "Chuck" } A A tuple with three items B A list with six items C A list of tuples D A list with three items E A dictionary with three key / value pairs

E

What will the '\$' regular expression match? A A new line at the end of a line B The beginning of a line C An empty line D The end of a line E A dollar sign

E

What will the following Python program print out? x = -1 for value in [3, 41, 12, 9, 74, 15] : if value > x : x = value print(x) A 15 B -1 C 3 D 9 E 74

E

What would the following Python code print out? abc = "With three words" stuff = abc.split() print(stuff) A ['With the', 'ee words'] B ['With', 'three words'] C ['With three words'] D ['w', 'i', 't', 'h'] E ['With', 'three', 'words']

E

When reading data across the network (i.e. from a URL) in Python 3, what method must be used to convert it to the internal format used by strings? A convert() B more() C msub() D encode() E decode()

E

Which of the following TCP sockets is most commonly used for the web protocol (HTTP)? A 25 B 22 C 119 D 23 E 80

E

Which of the following is most similar to a TCP port number? A A telephone number B A street number in an address C The distance between two locations D The GPS coordinates of a building E A telephone extension

E

Which of the following is the database software used in this class? A Postgres B Oracle C MySQL D SQL Server E SQLite

E

Which of the following is the label we give a column that the "outside world" uses to look up a particular row? A Primary key B Remote key C Local key D Foreign key E Logical key

E

What would the following Python code sequence print out? zap = "hello there bob" print(zap[4]) A hello B l C zap D You would get an out-of-range error and the program would fail E e F o

F

A primary key can be set to null. True False

False


Related study sets

World's Largest Countries by Population

View Set

The Art of Public Speaking (Lucas) Chapter 7

View Set

CHAPTER 11: APPENDICULAR STRUCTURE

View Set

Chapter 8: Adolescents, Young Adults, and Adults

View Set

Pharmacology Black 1 Part I Ch 4;5;9;10;11&12

View Set