Python (Final Examination) Copy
Quiz Summary
0 of 30 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 30 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- Current
- Review
- Answered
- Correct
- Incorrect
-
Question 1 of 30
1. Question
Question 1
which of the following are not python data types ?
CorrectIncorrect -
Question 2 of 30
2. Question
Question 2
The following converts data into a string, data type
CorrectIncorrect -
Question 3 of 30
3. Question
Question 3
Which of the following will run with error ?
CorrectIncorrect -
Question 4 of 30
4. Question
Question 4
Which of the following is not a float ?
CorrectIncorrect -
Question 5 of 30
5. Question
Question 5
Which of the following will return a false ?
CorrectIncorrect -
Question 6 of 30
6. Question
Question 6
S = ‘{0} is {0} years old.’.format(25, ‘Bob’) .print(S) The following will print out ?
CorrectIncorrect -
Question 7 of 30
7. Question
Question 7
txt = “Hello, welcome to my world.” Which of the following will throw an error?
CorrectIncorrect -
Question 8 of 30
8. Question
Question 8
txt = “Company12#”
x = txt.isalnum()
print(x) . The expression will return …CorrectIncorrect -
Question 9 of 30
9. Question
Question 9
students1=["Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" ] students2=("Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" ) students3={"Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" }
students1[:]
CorrectIncorrect -
Question 10 of 30
10. Question
Question 10
students1=["Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" ] students2=("Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" ) students3={"Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" }
students1[::-1]
CorrectIncorrect -
Question 11 of 30
11. Question
Question 11
students1=["Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" ] students2=("Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" ) students3={"Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" }
students3[5]=students1[5] . the new value of students3[5] is
CorrectIncorrect -
Question 12 of 30
12. Question
Question 12
students1=["Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" ] students2=("Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" ) students3={"Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" }
students2[5]=students1[4] . the new value of students2[5] is
CorrectIncorrect -
Question 13 of 30
13. Question
Question 13
students1=["Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" ] students2=("Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" ) students3={"Bello Sanni","Wale Adams", "Jamiu Adeleye","Mathew Osundu","Tunde Mikels","John Ochugbo" "Mary Ngozi","Funmi Awale","Beuty Bella","Yemisi Adeleke","Bunmi Esho" }
students1[5]=students3[8] . the new value of students1[5] is
CorrectIncorrect -
Question 14 of 30
14. Question
Question 14
new = students1
new2 = list(students1)new === new2
CorrectIncorrect -
Question 15 of 30
15. Question
Question 15
st1=[“Bello Sanni”,”Wale Adams”,”Jamiu Adeleye”,”Mathew Osundu”,”Tunde Mikels”,”John Ochugbo”
“Mary Ngozi”,”Funmi Awale”,”Beuty Bella”,”Yemisi Adeleke”,”Bunmi Esho”]
xx=[“Simi2 Anibaba”,”Yele2,Bello”,”Tunde2 Mikels”]
for y in xx:
st1.append(y)xx[1] === st1[12]
CorrectIncorrect -
Question 16 of 30
16. Question
Question 16
len(st1) is len(students1) + len(xx)
CorrectIncorrect -
Question 17 of 30
17. Question
Question 17
a = [1, 2]
b = [3, 4]
a[len(a):] = b . the new value of a isCorrectIncorrect -
Question 18 of 30
18. Question
Question 18
def plus(a,b = 2):
return a + b . what will the following return plus(10),plus(19),plus(-21)CorrectIncorrect -
Question 19 of 30
19. Question
Question 19
def fill(*args):
return sum(args) fill(1,2,3,4,5). Which is the correct result ?CorrectIncorrect -
Question 20 of 30
20. Question
Question 20
list1 = []
# Index ranges from 1 to 10 to multiply
for i in range(1, x ):
list1.append(4*i)WHAT IS THE POSSIBLE VALUE OF X
print(list1) result is [4, 8, 12, 16, 20, 24, 28, 32, 36, 40]
CorrectIncorrect -
Question 21 of 30
21. Question
Question 21
list2 = []
for i in range(0,y):
list2.append(list1[i]%5==0)
print(list2)
WHAT IS THE POSSIBLE VALUE OF Y ?
[False, False, False, False, True, False, False, False, False, True]CorrectIncorrect -
Question 22 of 30
22. Question
Question 22
def exel():
a=1
b=4
c=a*b
exel.d=a*b
msg=”the message: result is : “
exel.msg=”the function message: result is : “
#print(msg,c)
exel()##WHICH OF THE FOLLOWING WILL WORK FOR THE FUNCTION
#A #print (msg ,c)
#B #print (c)
#C #print(exel.msg)
#D #print(exel.d)A , B , none of them , all of them ,C
CorrectIncorrect -
Question 23 of 30
23. Question
Question 23
mydb = mysql.connector.connect(
host=”localhost”,
user=”root”,
passwd=””,
database = “users”
)
mycursor = mydb.cursor() Will this code run without error?CorrectIncorrect -
Question 24 of 30
24. Question
Question 24
host=”localhost”,
user=”root”,
passwd=””,
database = “users”
)
mycursor = mydb.cursor()
query2=”SELECT * FROM mileageUsers WHERE id=’3′”THE ABOVE QUERY WILL ?
CorrectIncorrect -
Question 25 of 30
25. Question
Question 25
###CODE 1 query1="SELECT * FROM mileageUsers where id='4'" , query2="SELECT * FROM mileageUsers " mycursor.execute(query1) rrset1 = mycursor.fetchone() print (rrset1) mycursor.execute(query2) rrset = mycursor.fetchall() for y in rrset: print (y) ###CODE 2 query1="SELECT * FROM mileageUsers WHERE id='5'" query2="SELECT * FROM mileageUsers WHERE id='3'" mycursor.execute(query1) mydb.commit() rset = mycursor.fetchall() current=rset[0][4] newcurrent=current +6 print (newcurrent ) query2="UPDATE mileageusers SET mileages={} WHERE id='3'".format(newcurrent) ####CODE 3 #q1="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('DELE ABBEY','Dabey@eml.com','+234123456080','8')" #q2="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('ANDY ABBEY','andy@eml.com','+234123456080','8')" #q3="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('LEKE ABBEY','leke@eml.com','+234123456080','8')" #q4="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('TUNDE ABBEY','tunde@eml.com','+234123456080','8')" #q5="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('BENI ABBEY','beni@eml.com','+234123456080','8')" #mycursor.execute(query) #mydb.commit
#in the above query which of the following will display all the users
# ?CorrectIncorrect -
Question 26 of 30
26. Question
Question 26
###CODE 1 query1="SELECT * FROM mileageUsers where id='4'" , query2="SELECT * FROM mileageUsers " mycursor.execute(query1) rrset1 = mycursor.fetchone() print (rrset1) mycursor.execute(query2) rrset = mycursor.fetchall() for y in rrset: print (y) ###CODE 2 query1="SELECT * FROM mileageUsers WHERE id='5'" query2="SELECT * FROM mileageUsers WHERE id='3'" mycursor.execute(query1) mydb.commit() rset = mycursor.fetchall() current=rset[0][4] newcurrent=current +6 print (newcurrent ) query2="UPDATE mileageusers SET mileages={} WHERE id='3'".format(newcurrent) ####CODE 3 #q1="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('DELE ABBEY','Dabey@eml.com','+234123456080','8')" #q2="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('ANDY ABBEY','andy@eml.com','+234123456080','8')" #q3="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('LEKE ABBEY','leke@eml.com','+234123456080','8')" #q4="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('TUNDE ABBEY','tunde@eml.com','+234123456080','8')" #q5="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('BENI ABBEY','beni@eml.com','+234123456080','8')" #mycursor.execute(query) #mydb.commit
#in the above query which of the following will update the current details of the user 3
#?A CODE 1 ,B -CODE 1 QUERY1 ,CODE 1 QUERY 2 , D – NON OF THE ABOVE
CorrectIncorrect -
Question 27 of 30
27. Question
Question 27
###CODE 1 query1="SELECT * FROM mileageUsers where id='4'" , query2="SELECT * FROM mileageUsers " mycursor.execute(query1) rrset1 = mycursor.fetchone() print (rrset1) mycursor.execute(query2) rrset = mycursor.fetchall() for y in rrset: print (y) ###CODE 2 query1="SELECT * FROM mileageUsers WHERE id='5'" query2="SELECT * FROM mileageUsers WHERE id='3'" mycursor.execute(query1) mydb.commit() rset = mycursor.fetchall() current=rset[0][4] newcurrent=current +6 print (newcurrent ) query2="UPDATE mileageusers SET mileages={} WHERE id='3'".format(newcurrent) ####CODE 3 #q1="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('DELE ABBEY','Dabey@eml.com','+234123456080','8')" #q2="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('ANDY ABBEY','andy@eml.com','+234123456080','8')" #q3="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('LEKE ABBEY','leke@eml.com','+234123456080','8')" #q4="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('TUNDE ABBEY','tunde@eml.com','+234123456080','8')" #q5="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('BENI ABBEY','beni@eml.com','+234123456080','8')" #mycursor.execute(query) #mydb.commit
#in the above query which will insert a new record for the user 8 FOR a table with 5 users
#if all are run successively
#CorrectIncorrect -
Question 28 of 30
28. Question
Question 28
###CODE 1 query1="SELECT * FROM mileageUsers where id='4'" , query2="SELECT * FROM mileageUsers " mycursor.execute(query1) rrset1 = mycursor.fetchone() print (rrset1) mycursor.execute(query2) rrset = mycursor.fetchall() for y in rrset: print (y) ###CODE 2 query1="SELECT * FROM mileageUsers WHERE id='5'" query2="SELECT * FROM mileageUsers WHERE id='3'" mycursor.execute(query1) mydb.commit() rset = mycursor.fetchall() current=rset[0][4] newcurrent=current +6 print (newcurrent ) query2="UPDATE mileageusers SET mileages={} WHERE id='3'".format(newcurrent) ####CODE 3 #q1="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('DELE ABBEY','Dabey@eml.com','+234123456080','8')" #q2="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('ANDY ABBEY','andy@eml.com','+234123456080','8')" #q3="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('LEKE ABBEY','leke@eml.com','+234123456080','8')" #q4="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('TUNDE ABBEY','tunde@eml.com','+234123456080','8')" #q5="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('BENI ABBEY','beni@eml.com','+234123456080','8')" #mycursor.execute(query) #mydb.commit
#in the above query which of the following will display the user 5
#CorrectIncorrect -
Question 29 of 30
29. Question
Question 29
###code 4 # A query2="UPDATE mileageusers SET mileages={} WHERE id='8'".format(newcurrent) # B query1="SELECT * FROM mileageUsers where id='8'" # C query="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('Vivian Abey','vabey@eml.com','+234123456080','8') where id='8' " # D NON of the above #E query1="SELECT * FROM mileageUsers where id='5'"
#in the above query with id set to 8 which qury will be appropriate
#A CODE 4 A,B CODE 4 B ,CODE 4 C ,CODE 4 D
CorrectIncorrect -
Question 30 of 30
30. Question
Question 30
###code 4 # A query2="UPDATE mileageusers SET mileages={} WHERE id='8'".format(newcurrent) # B query1="SELECT * FROM mileageUsers where id='8'" # C query="INSERT INTO mileageUsers (names,email,phonenumber,mileages) VALUES('Vivian Abey','vabey@eml.com','+234123456080','8') where id='8' " # D NON of the above #E query1="SELECT * FROM mileageUsers where id='5'"
#in the above query with id set to 10 which qury will be appropriate
#CorrectIncorrect