Download Proglan Midterms Set A Transition Term SY201415 Ronald L

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Proglan Midterms Set A
Transition Term SY201415 Ronald L. Ramos
Name: Roldan, Richmond Roy R.
Student Number: 11298235
Course: BS-IS
Answer the following questions as best as you can. Save the file as “Proglan Transition Term SY201415 –
yourfullname.doc”
When done upload the document to your wikifolder and update your wiki page.
The following will merit an automatic zero in the exam:
1. Plagiarizing answers
2. Copying from a classmate/seatmate
3. Opening facebook or any form of social media
4. Talking to a classmate/seatmate during the exam
Open notes. Open Internet. Closed Social Media sites.
Goodluck and Godspeed!
Python (60 points)
1. (30 points) Write a small Python program that has two functions that will convert temperatures
back and forth from the Celsius and Fahrenheit temperature scales. The formulas for making the
conversion are as follows:
Fahrenheit to Celsius: Cel s=(5/9)*(Fahr-32)
Celsius to Fahrenheit: Fahr =(9/5)*Cels+32
Sample output:
Temperature Conversion
Given: 20 C, 68 F
C to F: 20 deg Celsius = 68 deg Fahrenheit
F to C 68 deg Fahrenheit = 20 deg Celsius
Paste your code here:
F = int(raw_input("Enter a temperature in Fahrenheit: "))
Celsius = (F - 32) * 5.0/9.0
C = int(raw_input("Enter a temperature in Celsius: "))
Fahrenheit = 9.0/5.0 * C + 32
print "F to C :", F, "Fahrenheit = ", Celsius, " Celsius"
print "C To F :", C, "Celsius = ", Fahrenheit, " Fahrenheit"
2. (5 points) Given a variable, x, what is the command to get python to print out the type of x?
Paste your code here: print x
3. (5 points) What is a statement? Give 2 examples.
A statement is a line of code that the Python interpreter can execute. print and
assignment are 2 good examples of a statement.
4. (5 points) What is an expression? Give 2 examples.
An expression is a combination of values, variables, and operators. If you type an
expression on the command line, the interpreter compiles it and displays the result
5. (5 points) What is the difference between a statement and an expression?
Statement is the one that displays output with the help of keywords it a small but a standalone
in python, while on the other hand expression is something that are in the codes but are not
displayable unless we use statements.
6. (10 points) The following statement produces no screen output: 3.14 * 6 * 6. Modify it to
produce a screen output.
Paste your code here:
float1 = 3.14
int1 = 6
int2 = 6
print float1*int1*int2
HTML5 (40 Points)
1. (10 points) Write the basic skeleton of an HTML 4 document.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>HTML4</title>
<style></style>
</head>
<body>
</body>
</html>
2. (10 points)
Write the basic skeleton of an HTML 5 document.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Smashing HTML5!</title>
<link rel="stylesheet" href="css/main.css" type="text/css" />
</head>
<body>
</body>
</html>
3. (10 points) Create an HTML5 document with a canvas 300pixels wide by 300 pixels tall. Put a
black border around the canvas.
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="300px" height="300px" style="border:1px solid #000000;">
Your browser does not support the HTML5 canvas tag.
</canvas>
</body>
</html>
4. (10 points) Create an HTML5 document with a canvas 300pixels wide by 300 pixels tall. Put a
black border around the canvas. Put a blue square on the upper left corner of the canvas and a
green square on the lower right corner of the canvas.
Bonus (Optional – each answer must have a minimum of one paragraph with at least 3 sentences per
paragraph)
1. (10 points) What characteristics define a good programming language? Explain each
characteristic.
Readability, meaning it can be easily comprehended even by someone who is not familiar in a
certain language.
Portability, if you are changing platforms there is no need to have major changes in the codes.
Efficiency, can it do its job efficiently.
2. (10 points) Cite an example of a good programming language to learn and explain why you
should learn it.
I think Java would be a good programming language to learn. Based on my experience in Java
you could do a lot of things with it. And there are a lot if Open source IDE. I have learned about
java here in csb, but I think there is still more to learn.
/rlr2015 AMDG.