Quiz 1. CSCI 115. Programming Fundamentals

(4 pts.) What are the types of individual variables? Write their data types on the empty blank.
Answer
A=3; >>> type (a);
B = 5.2 >>>type(b);
C = ‘7.3’ >>>type(c);
B = ‘hello world’;type(d);
(4 pts.) Which of the following are legal variable names in the Python language? Mark the circles at the second column if the variable’s name is legal.
Yes
No
A3
9a
Print
_Num_3
(4 pts) Assume variable a holds 2 and variable b holds the value 4, then write the result of operators:
Answer
A - b
A+b*a
A**b
A + b
(4 pts.) What would be expected output of print() function if we run the following code? >>> a = ‘nazarbayev’ >>> b = ‘university’ >>> c = a + ‘ ’ +b
Answer
Print( c )
Print( 2*b )
Print( a[1:] )
Print( b[0::1] )
(14 pts.) Hand writing coding test.

1-1) Ask the user to input three individual numbers and then output their average. The average value should be the float data type and include two decimal points. 

1-2) Print out an exact same sentence with the given three numbers as below:

'User's input numbers are {num1}, {num2}, and {num3}.'

2-1) Create a list type variable which contains three strings: 'Kazakhstan''Russia', and 'Korea'. Print out the list. 

3-1) Create a dictionary type variable which contains a pair of {num:country}, I.e., three input numbers should be the keys for three string values in the list. Print out the dictionary.

4-1) Create a string value by concatenating three values in dictionary. Individual values are divides by ',' symbol with a single space, I.e., 'Kazakhstan, Russia, Korea'. Print out the string. 

Expected output: 

>>> input first number: 4
>>> input second number: 7
>>> input third number: 9
Average value is : 6.67
User's input numbers are 4, 7, and 9.
['Kazakhstan', 'Russa', 'Korea']
{'4': 'Kazakhstan', '7': 'Russa', '9': 'Korea'}
Kazakhstan, Russa, Korea

{"name":"Quiz 1. CSCI 115. Programming Fundamentals", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"(4 pts.) What are the types of individual variables? Write their data types on the empty blank., answer, a=3; >>> type (a);","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
Powered by: Quiz Maker