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

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

2 / 60

What will be the output of the following Python code?

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

3 / 60

Which of the following is incorrect?

4 / 60

Which of the following character is used to give single-line comments in Python?

5 / 60

What will be the output of the following Python code?

def c(f):
    def inner(*args, **kargs):
        inner.co += 1
        return f(*args, **kargs)
    inner.co = 0
    return inner
@c
def fnc():
    pass
if __name__ == '__main__':
    fnc()
    fnc()
    fnc()
    print(fnc.co)

a) 4
b) 3
c) 0
d) 1

6 / 60

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

x & y

 

7 / 60

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

'%d %s %g you' %(1, 'hello', 4.0)

8 / 60

What will be the output of the following Python code?

def ordi():
	print("Ordinary")
ordi
ordi()

 

9 / 60

What will be the output of the following Python code?

'{a}, {0}, {abc}'.format(10, a=2.5, abc=[1, 2])

10 / 60

To find the decimal value of 1111, that is 15, we can use the function:

11 / 60

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

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

 

12 / 60

‘Bit’ stands for

13 / 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")

 

 

14 / 60

What will be the output of the following Python code?

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

 

15 / 60

Which of the following is the truncation division operator?

16 / 60

Which type of Programming does Python support?

17 / 60

What will be the output of the following Python code?

for i in range(float('inf')):
    print (i)

18 / 60

Which among the following list of operators has the highest precedence?

 +, -, **, %, /, <<, >>, |

19 / 60

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

x>>2

 

20 / 60

What will be the output of the following Python code?

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

21 / 60

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

22 / 60

Evaluate the expression given below if A = 16 and B = 15.

A % B // A

a) 0.0
b) 0
c) 1.0
d) 1

23 / 60

Which of the following is not a core data type in Python programming?

24 / 60

What will be the output of the following Python code?

'%x %d' %(255, 255)

25 / 60

Which of the following is a Python tuple?

26 / 60

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

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

 

27 / 60

What will be the output of the following Python code?

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

28 / 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)

29 / 60

What are the values of the following Python expressions?

 2**(3**2)
 (2**3)**2
 2**3**2

 

30 / 60

Which function is called when the following Python program is executed?

f = foo()
format(f)

 

31 / 60

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

x=3.3456789
'%-6.2f | %05.2f | %+06.1f' %(x, x, x)

 

32 / 60

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

x=3.3456789
'%f | %e | %g' %(x, x, x)

33 / 60

The output of the two codes shown below is the same.

i. bin((2**16)-1)
ii. '{}'.format(bin((2**16)-1))

34 / 60

The expression 2**2**3 is evaluates as: (2**2)**3.

35 / 60

What will be the output of the following Python code?

def mk(x):
    def mk1():
        print("Decorated")
        x()
    return mk1
def mk2():
    print("Ordinary")
p = mk(mk2)
p()

36 / 60

What is the result of round(0.5) – round(-0.5)?

37 / 60

What will be the output of the following Python expression if X=345?

print(“%06d”%X)

38 / 60

Which keyword is used to call a function in Python language?

39 / 60

The following are python reserved words excerpt

40 / 60

What will be the output of the following Python code?

hex(255), int('FF', 16), 0xFF

41 / 60

Which of the following is a feature of Python DocString?

42 / 60

What will be the output of the following Python code?

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

43 / 60

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

print("%.2f"%x)

44 / 60

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

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

45 / 60

The following python code can work with ____ parameters.

def f(x):
    def f1(*args, **kwargs):
           print("Sanfoundry")
           return x(*args, **kwargs)
    return f1

 

 

46 / 60

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

47 / 60

What will be the output of the following Python code?

for i in range(0):
    print(i)

48 / 60

What will be the output of the following Python code?

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

49 / 60

What is the type of inf?

50 / 60

Which of these is the definition for packages in Python?

51 / 60

To add a new element to a list we use which Python command?

52 / 60

Which type of Programming does Python support?

53 / 60

What arithmetic operators cannot be used with strings in Python?

54 / 60

What will be the output of the following Python expression?

24//6%3, 24//4//2

 

55 / 60

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

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

56 / 60

What will be the output of the following Python expression?

round(4.576)

 

57 / 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

58 / 60

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

 

c

 

59 / 60

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

'%(qty)d more %(food)s' %{'qty':1, 'food': 'spam'}

60 / 60

What will be the output of the following Python code?

x = "abcdef"
i = "a"
while i in x[1:]:
    print(i, end = " ")

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.