Connect with us

ACADEMICS

OAU CSC 201 Practice Quiz

Published

on

/60
3 votes, 3.3 avg
569
Created by Oluwaferanmi Akinyele

OAU CSC 201 Practice Quiz

Welcome to the CSC 201 Exam Practice Quiz! All questions are from Sanfoundry.com and have been randomized for each attempt. The quiz will be updated regularly until the exam on Saturday. Use the Full Screen button at the top right for a better experience. Keep practicing, and good luck!

1 / 60

What will be the output of the following Python code if a=10 and b =20?

a=10
b=20
a=a^b
b=a^b
a=a^b
print(a,b)

2 / 60

A ________ is a sequence of instructions telling the computer what to do.

3 / 60

What will be the output of the following Python code?

class Truth:
	pass
x=Truth()
bool(x)

4 / 60

What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for i in d:
    print(i)

 

5 / 60

The expression shown below results in an error.

print("-%5d0",989)

a) True
b) False

6 / 60

Python was created in what year

7 / 60

What will be the output of the following Python code snippet?

z=set('abc$de')
'a' in z

 

8 / 60

Which of the following expressions involves coercion when evaluated in Python?

9 / 60

Which of the following is incorrect?

10 / 60

What will be the value of X in the following Python expression?

“`X = 2+9*((3*12)-8)/10“`

11 / 60

Which one of the following is the use of function in python?

12 / 60

What will be the output of the following Python code?

print("Hello {0[0]} and {0[1]}".format(('foo', 'bin')))Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
b) Error
c) Hello foo and bin
d) None of the mentioned

13 / 60

What will be the output of the following Python code?

x = "abcdef"
i = "a"
while i in x:
    print('i', end = " ")

14 / 60

What will be the output of the following Python expression?

print(4.00/(2.0+2.0))

 

15 / 60

What will be the value of x in the following Python expression?

x = int(43.55+2/2)

16 / 60

What is the result of cmp(3, 1)?

17 / 60

What will be the output of the following Python expression if the value of x is 34?

print(“%f”%x)

 

 

18 / 60

Which of the following Python statements will result in the output: 6?

A = [[1, 2, 3],
     [4, 5, 6],
     [7, 8, 9]]

 

19 / 60

Which of the following results in a SyntaxError?

20 / 60

The one’s complement of 110010101 is:

21 / 60

What is the order of namespaces in which Python looks for an identifier?

22 / 60

What will be the output of the following Python code snippet?

x = 'abcd'
for i in range(len(x)):
    i[x].upper()
print (x)
c

23 / 60

Which one of the following is the use of function in python?

24 / 60

What will be the output of the python code shown below for various styles of format specifiers?

x=1234
res='integers:...%d...%-6d...%06d' %(x, x, x)
res

25 / 60

Which of the following statements is used to create an empty set in Python?

26 / 60

Which one of the following is not a keyword in Python language?

27 / 60

The ______ symbol along with the name of the decorator function can be placed above the definition of the function to be decorated works as an alternate way for decorating a function.

 

28 / 60

What will be the value of the following Python expression?

float(4+int(2.39)%2)

 

29 / 60

What will be the output of the following Python code?

x = 'abcd'
for i in range(len(x)):
    print(i.upper())

30 / 60

What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.keys():
    print(d[x])

31 / 60

What will be the output of the following Python code?

d = {0, 1, 2}
for x in d.values():
    print(x)

32 / 60

What will be the output of the following Python code?

i = 1
while True:
    if i%2 == 0:
        break
    print(i)
    i += 2

33 / 60

All keywords in Python are in _________

34 / 60

What will be the output of the following Python expression?

bin(29)

 

35 / 60

What are the two main types of functions in Python?

36 / 60

What will be the output of the following Python program?

i = 0
while i < 5:
    print(i)
    i += 1
    if i == 3:
        break
else:
    print(0)

37 / 60

What will be the output of the following Python code?

 D=dict(p='san', q='foundry')
'{p}{q}'.format(**D)

 

38 / 60

What will be the output of the following Python code snippet?

for i in [1, 2, 3, 4][::-1]:
    print(i, end=' ')

a) 4 3 2 1
b) error
c) 1 2 3 4
d) none of the mentioned

39 / 60

The following is displayed by a print function call. Select all of the function calls that result in this output.

tom
dick
harry

 

40 / 60

What will be the output of the following Python code?

d = {0, 1, 2}
for x in d:
    print(x)

 

41 / 60

Which of the following is the correct extension of the Python file?

42 / 60

What will be the output of the following Python code?

class A:
    @staticmethod
    def a(x):
        print(x)
A.a(100)

 

43 / 60

What will be the output of the following Python code?

i = 0
while i < 3:
    print(i)
    i += 1
else:
    print(0)

44 / 60

What will be the output of the following Python code?

['f', 't'][bool('spam')]

a) t
b) f
c) No output
d) Error

45 / 60

What will be the output of the following Python code snippet?

X=”hi”
print(“05d”%X)

46 / 60

What will be the value of x in the following Python expression, if the result of that expression is 2?

x>>2

 

47 / 60

What will be the output of the following Python code?

i = 5
while True:
    if i%0O11 == 0:
        break
    print(i)
    i += 1

48 / 60

Which of the following expressions can be used to multiply a given number ‘a’ by 4?

8.

49 / 60

What will be the output of the following Python code snippet if x=1?

x<<2

 

50 / 60

What is output of print(math.pow(3, 2))?

51 / 60

What will be the output of the following Python code?

i = 2
while True:
    if i%3 == 0:
        break
    print(i)
    i += 2

52 / 60

What will be the output of the following Python expression if x=15 and y=12?

x & y

 

53 / 60

What will be the output of the following Python code?

  1. class tester:
  2.     def __init__(self, id):
  3.         self.id = str(id)
  4.         id="224"
  5. 
    
  6. >>>temp = tester(12)
  7. >>>print(temp.id)

a)

54 / 60

Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’?

 

c

 

55 / 60

What will be the output of the following Python expression if x=22.19?

print("%5.2f"%x)

 

56 / 60

What will be the output of the following Python expression?

int(1011)?

57 / 60

What will be the output of the following Python expression if x=456?

print("%-06d"%x)

 

58 / 60

Which of the following is incorrect?

59 / 60

What will be the output of the following Python code?

def f(x):
    def f1(*args, **kwargs):
        print("*", 5)
        x(*args, **kwargs)
        print("*", 5)
    return f1
@f
def p(m):
    p(m)
print("hello")

 

 

60 / 60

Which one of the following has the highest precedence in the expression?

Your score is

The average score is 22%

0%


Discover more from 9jabaz

Subscribe to get the latest posts to your email.

Advertisement
Comments
Scroll Up

Discover more from 9jabaz

Subscribe now to keep reading and get access to the full archive.

Continue reading

..

9jabaz.