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 snippet?

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

2 / 60

The following python code can work with ____ parameters.

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

 

 

3 / 60

Operators with the same precedence are evaluated in which manner?

4 / 60

What will be the output of the following Python code?

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

5 / 60

Which of the following is a Python tuple?

6 / 60

What will be the value of the following Python expression?

4 + 3 % 5

 

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

8 / 60

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

9 / 60

Which of the following is invalid?

10 / 60

Which of the following is a feature of Python DocString?

11 / 60

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

 

12 / 60

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

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

13 / 60

What will be the output of the following Python code?

'{a}{b}{a}'.format(a='hello', b='world')

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

 

15 / 60

The expression

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

16 / 60

What will be the output of the following Python code?

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

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

17 / 60

What will be the output of the following Python code?

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

18 / 60

What will be the output of the following Python code?

if (9 < 0) and (0 < -9):
    print("hello")
elif (9 > 0) or False:
    print("good")
else:
    print("bad")

 

19 / 60

What does ~4 evaluate to?
a) -5
b) -4
c) -3
d) +3

20 / 60

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

21 / 60

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

22 / 60

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

x & y

 

23 / 60

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

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

 

24 / 60

All keywords in Python are in _________

25 / 60

What will be the output of the following Python code?

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

26 / 60

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

  1. def example(a):
  2.     a = a + '2'
  3.      a = a*2
  4.     return a
  5. >>>example("hello")

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

28 / 60

Which of the following expressions results in an error?

29 / 60

Which is the correct operator for power(xy)?

30 / 60

The following python program can work with ____ parameters.

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

 

31 / 60

What is the value of the following expression?

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

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

33 / 60

What will be the output of the following Python code?

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

 

34 / 60

What will be the output of the following Python expression?

~100?

35 / 60

What will be the value of the following Python expression?

4 + 3 % 5

 

36 / 60

What will be the output of the following Python code?

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

 

37 / 60

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

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

38 / 60

What will be the output of the following Python code?

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

 

39 / 60

What will be the output of the following Python code?

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

40 / 60

What will be the output of the following Python code?

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

41 / 60

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

apple = mango

 

42 / 60

What will be the output of the following Python code?

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

 

43 / 60

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

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

45 / 60

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

8.

46 / 60

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

47 / 60

Which one of the following has the same precedence level?

48 / 60

The following is true about python except

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

50 / 60

What will be the output of the following Python code?

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

 

51 / 60

Which of the following is not a keyword?

52 / 60

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

53 / 60

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

54 / 60

What will be the output of the following Python program?

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

 

55 / 60

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

bool(False)
bool()

I

   True 
   True
II
   False
   True

III

   False
   False

IV

   True
   False

Which of I-IV is correct?

56 / 60

What will be the output of the following Python code?

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

 

Control does not enter the loop because of False.

57 / 60

What will be the output of the following Python code?

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

 

58 / 60

What will be the output of the following Python code?

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

59 / 60

What will be the output of the following Python code?

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

 

60 / 60

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

print("%-06d"%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.