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 is the return value of trunc()?

2 / 60

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

x=3.3456789
'%s' %x, str(x)

 

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

4 / 60

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

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

5 / 60

What will be the output of the following Python code?

def f(x):
    def f1(a, b):
        print("hello")
        if b==0:
            print("NO")
            return
        return f(a, b)
    return f1
@f
def f(a, b):
    return a%b
f(4,0)

6 / 60

What will be the output of the following Python code?

print("abc. DEF".capitalize())

7 / 60

Which of the following functions is a built-in function in python?

8 / 60

What will be the output of the following Python code?

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

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

10 / 60

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

 

c

 

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

 

12 / 60

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

13 / 60

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

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

14 / 60

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

print("%5.2f"%x)

 

15 / 60

The following are high-level languages except

16 / 60

Which of the following is the use of id() function in python?

17 / 60

What is the value of the following expression?

8/4/2, 8/(4/2)

 

18 / 60

Which of the following is incorrect?

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

20 / 60

What will be the output of the following Python code?

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

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

 

22 / 60

Which one of the following has the same precedence level?

23 / 60

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

24 / 60

What will be the value of the following Python expression?

4 + 3 % 5

 

25 / 60

Which of the following represents the bitwise XOR operator?

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

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 will be the output of the following Python code?

s='{0}, {1}, and {2}'
s.format('hello', 'good', 'morning')

 

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

30 / 60

What will be the output of the following Python code?

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

31 / 60

What will be the output of the following Python code?

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

32 / 60

The process of pickling in Python includes ____________

Pickling is the process of serializing a Python object, that is, conversion of a Python object hierarchy into a byte stream. The reverse of this process is known as unpickling.

33 / 60

Which type of Programming does Python support?

34 / 60

What will be the output of the following Python code?

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

 

35 / 60

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

36 / 60

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

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

37 / 60

What will be the output of the following Python code?

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

 

38 / 60

What will be the output of the following Python code?

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

39 / 60

The output of which of the codes shown below will be: “There are 4 blue birds.”?

 

40 / 60

Operating Systems includes the following except

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

42 / 60

What is the average value of the following Python code snippet?

  1. >>>grade1 = 80
  2. >>>grade2 = 90
  3. >>>average = (grade1 + grade2) / 2

43 / 60

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

44 / 60

What will be the output of the following Python code?

'{0:.2f}'.format(1.234)

45 / 60

Which of these in not a core data type?

46 / 60

What will be the output of the following Python code?

l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))

47 / 60

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

48 / 60

What is the type of inf?

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

 

 

50 / 60

What data type is the object below?

L = [1, 23, ‘hello’, 1]

51 / 60

Which module in the python standard library parses options received from the command line?getarg
b) getopt
c) main
d) os

52 / 60

What will be the output of the following Python code?

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

53 / 60

The expression

“`2**2**3“` is equal to “`(2**2)**3“`

54 / 60

Which of these is the definition for packages in Python?

55 / 60

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

56 / 60

What is the value of the following Python expression?

bin(0x8)

57 / 60

What will be the output of the following Python code?

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

58 / 60

What is the answer to this expression, 22 % 3 is?

59 / 60

Which of the following is the truncation division operator in Python?

60 / 60

What will be the output of the following Python code?

x = ['ab', 'cd']
for i in x:
    x.append(i.upper())
print(x)

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.