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?

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

2 / 60

What will be the output of the following Python expression?

int(1011)?

3 / 60

Python supports the creation of anonymous functions at runtime, using a construct called __________

4 / 60

What will be the output of the following Python code?

x = 123
for i in x:
    print(i)

 

5 / 60

What will be the output of the following Python code?

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

6 / 60

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

print(“%f”%x)

 

 

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

8 / 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')

9 / 60

The expression

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

10 / 60

Which type of Programming does Python support?

11 / 60

What is the maximum possible length of an identifier in Python?

12 / 60

What will be the output of the following Python expression?

bin(29)

 

13 / 60

Which of the following is the truncation division operator?

14 / 60

What will be the output of the following Python code?

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

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

15 / 60

Which of the following results in a SyntaxError?

16 / 60

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

17 / 60

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

for i in '':
    print (i)

18 / 60

A function with parameters cannot be decorated.

19 / 60

Which of the following is true for variable names in Python?

20 / 60

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

21 / 60

What will be the output of the following Python code?

'{0:f}, {1:2f}, {2:05.2f}'.format(1.23456, 1.23456, 1.23456)

 

22 / 60

Which of the following operators has its associativity from right to left?

23 / 60

What will be the output of the following Python code?

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

 

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

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

26 / 60

What will be the output of the following Python code?

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

27 / 60

Which of these is the definition for packages in Python?

28 / 60

Which of the following expressions results in an error?

29 / 60

The following are python reserved words excerpt

30 / 60

Is Python code compiled or interpreted?

31 / 60

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

not(3>4)
not(1&1)

I

   True
   True

II

   True
   False

III

   False
   True

IV
   False
   False

Which of the answers from I - IV is correct?

32 / 60

The following is true about python except

33 / 60

The outcome of a programming activity is a _________

34 / 60

What is the value of the following expression?

“`float(22//3+3/3)“`

35 / 60

Which of the following variable naming is correct

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

37 / 60

What will be the output of the following Python code?

True = False
while True:
    print(True)
    break

38 / 60

The expression shown below results in an error.

print("-%5d0",989)

a) True
b) False

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

40 / 60

What will be the value of the following Python expression?

float(4+int(2.39)%2)

 

41 / 60

What will be the output of the following Python program?

z=set('abc')
z.add('san')
z.update(set(['p', 'q']))
z

 

42 / 60

What will be the output of the following Python code?

'%s' %((1.23,),)

 

43 / 60

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

44 / 60

What is the value of the following expression?

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

 

45 / 60

Which of these in not a core data type?

46 / 60

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

 

c

 

47 / 60

What will be the output of the following Python expression?

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

 

48 / 60

What will be the output of the following Python expression?

0x35 | 0x75

49 / 60

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

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

 

50 / 60

What will be the output of the following Python code?

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

51 / 60

The following python code can work with ____ parameters.

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

 

 

52 / 60

What is the output of print 0.1 + 0.2 == 0.3?

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

 

 

54 / 60

What will be the output of the following Python code?

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

 

55 / 60

What will be the output of the following Python code?

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

56 / 60

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

print("%.2f"%x)

57 / 60

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

apple = mango

 

58 / 60

Machines developed in mechanical era include the following except

59 / 60

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

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

60 / 60

What will be the output of the following Python expression?

round(4.576)

 

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.