Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

1.

Assume that we execute the following assignment statements:


width = 17
height = 12.0
delimiter = '.'
What is the data type of the following expression: width/2.0?

Answer = Float

2. If

zoom = [ {"a":1}, {"b":2, "c":3} ]

what is the value of zoom[0]["a"]?


Answer = 1

3. What is the Python type of the following structure?

[ {"a":1}, {"b":2, "c":3} ]


Answer = List

4. What is the data type returned by the following Python expression: 4.0/2?
Answer = float

5. How do you define an instance method called herotime(), which does not take any parameters, for the
Python class Hero?

Answer = def herotime(self):


6. How do you define a constructor for a Python class called Hero?

Answer = d. def __init__(self):

7. The object ben10, which is an instance of class Hero, has the method herotime() which takes no
parameters. How do you call the method from your program?

Answer = ben10.herotime()

8. This is an object that belongs to a class.

Answer = instance

9. This is one of the named values associated with an object.

Answer = attribute

10. Which of the following is the correct way of defining the function zoom() in Python?

Answer = def zoom()


11. Which of the following is the proper way to define a class method fib() that accepts a required
parameter max?

Answer = def fib(self, max):

12. In order to make use of the square root sqrt() function, your program imports the math module
at the beginning using:

import math

Which of the following is the correct method of calling the sqrt() in your program?

Answer = math.sqrt(25)

13. Assume that we execute the following assignment statements:

width = 17
height = 12.0
delimiter = '.'

What is the data type of the following expression: width/2?

Answer = integer

14. If a = "Mechagodzilla", what is the output of a[0:4]?

Answer = Mech

15. If

zoom = [ {"a":1}, {"b":2, "c":3} ]

what is the value of zoom[0]?

Answer = {"a":1}

16. Which of the following are INLINE elements in HTML?


(p, image, form , span)

Answer = img, span

17. Which HTTP method is most often used for requesting a document from a server?

Answer = get

18. Given the URL http://www.addu.edu.ph:8080/page?page=front&items=30#news, the protocol part


of the URL is

Answer = http
19. Given http://www.addu.edu.ph:8080/page?page=front&items=30#news, what is the request line
to GET this URL using HTTP/1.1?

Answer = GET /page?page=front&items=30 HTTP/1.1

20. Which of these requests is for dynamic content?


(the facebook page, the Ateneo de Davao logo, a blog’s front page, a website’s favicon)

Answer: The Facebook Page, a blog’s front page

21. Arrange the following socket methods in the most logical order, from start to finish, of how they
are called in a server program.

Answer = 1. Socket(), 2. Bind() , 3. Listen(), 4. Accept() , 5. Receive() , 6. Close()

22. Which of the following are BLOCK elements in HTML?


(br, div , p, dv)

Answer = div, p

23. Given the URL http://www.addu.edu.ph:8080/page?page=front&items=30#news, the fragment


part of the URL is

Answer= #news

24. In the following URL, what is the value of the "page" parameter?

http://www.addu.edu.ph/page?page=front&items=30&category=news

Answer = front

25. Given the URL http://www.addu.edu.ph:8080/page?page=front&items=30#news, the query part of


the URL is

Answer = page=front&items=30

26. Given the URL http://www.addu.edu.ph:8080/page?page=front&items=30#news, the host part of


the URL is

Answer = www.addu.edu.ph

27. Given the protocol ftp, the host ftp1.addu.edu.ph, and the path /syllabus, what is the URL?

Answer = ftp://ftp1.addu.edu.ph/syllabus

28. What happens if you don't specify an ACTION parameter in a FORM?

Answer = the form submits to the page which contains it


29. Match the HTTP numeric response codes to their function

Answer = 100x: Informational , 200x: Success, 300x: Redirection, 400x: Client, 500x: Server

30. GET requests can be cached.

Answer = True

31. What happens if you don't specify a METHOD parameter in a FORM?

Answer = the METHOD defaults to a GET

32. A GET request is primarily used for fetching documents from the server.

Answer = True

33. In a POST request, the parameters are placed in the URL.

Answer = False

34. Which of these are appropriate for GET requests?


(fetching a document, requests that can be cached, updating data, sending a lot of data to the
server)

Answer = fetching a document, requests that can be cached

35. GET requests can change the server.

Answer = False
LESSON 1

You might also like