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 arithmetic operators cannot be used with strings in Python?

2 / 60

Which of the following is a feature of Python DocString?

3 / 60

What will be the output of the following Python program?

  1. def addItem(listParam):
  2.     listParam += [1]
  3. 
    
  4. mylist = [1, 2, 3, 4]
  5. addItem(mylist)
  6. print(len(mylist))

4 / 60

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

5 / 60

Which of the following is used to define a block of code in Python language?

6 / 60

What will be the output of the following Python code?

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

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

8 / 60

What will be the output of the following Python code?

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

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

9 / 60

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

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

10 / 60

In the following Python code, which function is the decorator?

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

11 / 60

What will be the output of the following Python code?

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

12 / 60

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

print(“%06d”%X)

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

14 / 60

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

x = 2
for i in range(x):
    x += 1
    print (x)

 

15 / 60

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

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

16 / 60

Who developed Python Programming Language?

17 / 60

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

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

18 / 60

What will be the output of the following Python code?

def d(f):
    def n(*args):
        return '$' + str(f(*args))
    return n
@d
def p(a, t):
    return a + a*t 
print(p(100,0))

a) 100
b) $100
c) $0
d) 0

19 / 60

What will be the output of the following Python code?

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

 

20 / 60

Identify the decorator in the snippet of code shown below.

def sf():
     pass
sf = mk(sf)
@f
def sf():
     return

21 / 60

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

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

22 / 60

What will be the output of the following Python code?

t = '%(a)s, %(b)s, %(c)s'
t % dict(a='hello', b='world', c='universe')

23 / 60

What will be the output of the following Python function?

def f(p, q):
	return p%q
f(0, 2)
f(2, 0)



                            

24 / 60

The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same.

25 / 60

Which of the following cannot be a variable?

26 / 60

Copy – The ______ is the brain of the computer that performs simple arithmetic & logical operations

27 / 60

Any odd number on being AND-ed with ________ always gives 1. Hint: Any even number on being AND-ed with this value always gives 0.
a) 10
b) 2
c) 1
d) 0

28 / 60

What does 3 ^ 4 evaluate to?

29 / 60

Is Python code compiled or interpreted?

30 / 60

What error occurs when you execute the following Python code snippet?

apple = mango

 

31 / 60

The ______ is the brain of the computer that performs simple arithmetic & logical operations

32 / 60

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

not(10<20) and not(10>30)

 

33 / 60

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

print("%5.2f"%x)

 

34 / 60

The two snippets of the following Python codes are equivalent.

CODE 1
  @f
def f1():
        print(“Hello”)
CODE 2
  def f1():
         print(“Hello”)
f1 = f(f1)

a) True
b) False

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

36 / 60

What will be the value of the following Python expression?

 bin(10-2)+bin(12^4)

37 / 60

What will be the output of the following Python code?

'%.2f%s' % (1.2345, 99)

38 / 60

Which type of Programming does Python support?

39 / 60

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

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

40 / 60

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

f = foo()
format(f)

 

41 / 60

What will be the output of the following Python code?

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

 

42 / 60

Which of the following is incorrect?

43 / 60

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

print("%-06d"%x)

 

44 / 60

Which of these is the definition for packages in Python?

45 / 60

Why are local variable names beginning with an underscore discouraged?

46 / 60

What will be the output of the following Python code?

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

 

47 / 60

What will be the output of the following Python expression?

round(4.576)

 

48 / 60

What will be the output of the following Python code?

l=list('HELLO')
p=l[0], l[-1], l[1:3]
'a={0}, b={1}, c={2}'.format(*p)

 

49 / 60

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

a='hello'
q=10
vars()

 

50 / 60

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

x & y

 

51 / 60

Which of the following is not a keyword?

52 / 60

What will be the output of the following Python code?

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

 

53 / 60

What will be the value of ‘result’ in following Python program?

list1 = [1,2,3,4]
list2 = [2,4,5,6]
list3 = [2,6,7,8]
result = list()
result.extend(i for i in list1 if i not in (list2+list3) and i not in result)
result.extend(i for i in list2 if i not in (list1+list3) and i not in result)
result.extend(i for i in list3 if i not in (list1+list2) and i not in result)

54 / 60

Given a function that does not return any value, What value is thrown by default when executed in shell.

55 / 60

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

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

56 / 60

The following are python reserved words excerpt

57 / 60

What will be the output of the following Python code?

def foo():
    try:
        return 1
    finally:
        return 2
k = foo()
print(k)

 

58 / 60

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

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

59 / 60

What is the output of this expression, 3*1**3?

60 / 60

What will be the output of the following Python code?

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

 

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.