CS256 – EXAM 1
1 Your current directory is /home. Create a new directory under todays date (nov11) and copy the file /home/nov7/answers.txt into the new directory you created.
2a 2 + 3 * 4 % (5 + 2 ) = 7
2b 165 mod 13 = 9
3 Write the output of the programs.
3a n = 90
while ( n >= 10):
if ( n % 20 == 0):
n = n – 10
80 60 40 20
3b a = ‘Hi’
b = a * 3
c = b + ‘How are you?’
d = c [0:6]
4 Write the output of the Program
str1 = ‘thIs exAM is onLY for practicING’
str2 = ‘Aa’
for ch in str1:
if not ch.islower() and ch not in str2 and not ch.isspace() :
5 Write down the final contents of the list. (Hint : A is less than a)
planets = [‘earth’,’mercury’,’Venus’,’Mars’]
planets. append ( ‘Jupiter’)
planets. sort ( )
planets. reverse ( )
mercury, earth, Venus, Mars
6 Write a program to read in 3 test scores. Take the highest two scores and calculate average score.
Print all the prime numbers between 0 to 100.
3 input statements
a = input(“Enter score 1”);
Write if else statements to get the biggest two.
Find the average.
Or you can put them in a list , sort it and take average from last two.
7 Write a Program to generate 10 random numbers between -100 and 100
Write a program to read in date of birth and make sure it is in mm/dd/yyyy format.
for i in range [0,11]:
i = random.randint(-100,101)
dob = raw_input(‘’);
length is 10
dob and dob is ‘’
dob[0:2] and dob [3:5] and dob[6:10] isdigit()
8 Write a Program to read in a file name. Open the file in read mode and count the number of characters, words and lines in the file.
9 Write a program using Visual Python module to:
> Assign a background color of your choice
> Create a ball at position (x , y , z)= ( -1, 1, 0) of radius = 0.5 and color of your choice.
> Create a Wall at position (x , y , z) = ( 3, 0, 0) of any size and color of your choice.
> Set the rate to 100 and make the ball to bounce off on the wall.
Write a program to define a Point Class, which has 2 attributes x-coordinate and y- coordinate. In the main function create 2 points(Instances of points) at (1.0, 1.0) and (5.0,1.0) and calculate the distance between them. (dist = sqrt( (x2-x1)^2 + (y2-y1)^2)
10 Bonus Question ( 5 points)
I love playing with strings and numbers. Can you understand my message?
Harry 0-2 Heaven 3-4 Gravity 2 Winnie 3-4 Advice 4-5 Doctor 0
Eat 1 Yummy 4
PLACE THIS ORDER OR A SIMILAR ORDER WITH US TODAY AND GET AN AMAZING DISCOUNT ?
Our Service Charter
Excellent Quality / 100% Plagiarism-FreeWe employ a number of measures to ensure top quality essays. The papers go through a system of quality control prior to delivery. We run plagiarism checks on each paper to ensure that they will be 100% plagiarism-free. So, only clean copies hit customers’ emails. We also never resell the papers completed by our writers. So, once it is checked using a plagiarism checker, the paper will be unique. Speaking of the academic writing standards, we will stick to the assignment brief given by the customer and assign the perfect writer. By saying “the perfect writer” we mean the one having an academic degree in the customer’s study field and positive feedback from other customers.
Free RevisionsWe keep the quality bar of all papers high. But in case you need some extra brilliance to the paper, here’s what to do. First of all, you can choose a top writer. It means that we will assign an expert with a degree in your subject. And secondly, you can rely on our editing services. Our editors will revise your papers, checking whether or not they comply with high standards of academic writing. In addition, editing entails adjusting content if it’s off the topic, adding more sources, refining the language style, and making sure the referencing style is followed.
Confidentiality / 100% No DisclosureWe make sure that clients’ personal data remains confidential and is not exploited for any purposes beyond those related to our services. We only ask you to provide us with the information that is required to produce the paper according to your writing needs. Please note that the payment info is protected as well. Feel free to refer to the support team for more information about our payment methods. The fact that you used our service is kept secret due to the advanced security standards. So, you can be sure that no one will find out that you got a paper from our writing service.
Money Back GuaranteeIf the writer doesn’t address all the questions on your assignment brief or the delivered paper appears to be off the topic, you can ask for a refund. Or, if it is applicable, you can opt in for free revision within 14-30 days, depending on your paper’s length. The revision or refund request should be sent within 14 days after delivery. The customer gets 100% money-back in case they haven't downloaded the paper. All approved refunds will be returned to the customer’s credit card or Bonus Balance in a form of store credit. Take a note that we will send an extra compensation if the customers goes with a store credit.
24/7 Customer SupportWe have a support team working 24/7 ready to give your issue concerning the order their immediate attention. If you have any questions about the ordering process, communication with the writer, payment options, feel free to join live chat. Be sure to get a fast response. They can also give you the exact price quote, taking into account the timing, desired academic level of the paper, and the number of pages.