Connect with us

ACADEMICS

OAU CSC 201 Practice Quiz

Published

on

/60
3 votes, 3.3 avg
573
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?

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

 

2 / 60

What will be the output of the following Python code?

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

 

3 / 60

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

4 / 60

In order to store values in terms of key and value we use what core data type.

5 / 60

Which of the following functions can help us to find the version of python that we are currently working on?

6 / 60

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

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

7 / 60

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

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

 

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

 

9 / 60

What will be the output of the following Python code?

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

10 / 60

Which of the following expressions results in an error?

11 / 60

Which of the following is a feature of Python DocString?

12 / 60

The following python code can work with ____ parameters.

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

 

 

13 / 60

What will be the output of the following Python code?

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

14 / 60

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

15 / 60

The expression

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

16 / 60

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

print(“%f”%x)

 

 

17 / 60

What is the value of the following expression?

2+4.00, 2**4.0

 

18 / 60

What will be the output of the following Python code?

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

 

19 / 60

What will be the output of the following Python function?

len(["hello",2, 4, 6])

a) Error
b) 6
c) 4
d) 3

20 / 60

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

21 / 60

A computer software comprises of ___________ software & ___________ software

22 / 60

What will be the output of the following Python code?

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

 

23 / 60

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

apple = mango

 

24 / 60

What is the return type of function id?

25 / 60

What will be the output of the following Python code snippet if x=1?

x<<2

 

26 / 60

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

27 / 60

What will be the value of x in the following Python expression?

x = int(43.55+2/2)

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

 

29 / 60

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

30 / 60

What is the value of the following expression?

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

 

31 / 60

6. In python we do not specify types, it is directly interpreted by the compiler, so consider the following operation to be performed.

  1.  >>>x = 13 ? 2

objective is to make sure x has a integer value, select all that apply (python 3.xx)

32 / 60

Which of the following will run without errors?

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

34 / 60

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

print("%.2f"%x)

35 / 60

Which type of Programming does Python support?

36 / 60

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

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

37 / 60

What will be the output of the following Python code?

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

38 / 60

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

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

39 / 60

What will be the output of the following Python code?

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

40 / 60

What will be the output of the following Python code?

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

 

41 / 60

Operators with the same precedence are evaluated in which manner?

42 / 60

What will be the output of the following Python expression?

round(4.576)

 

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

44 / 60

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

45 / 60

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

46 / 60

What will be the output of the following Python code?

x = [[0], [1]]
print((' '.join(list(map(str, x))),))

47 / 60

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

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

49 / 60

What is the order of precedence in python?

50 / 60

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

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

51 / 60

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

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

53 / 60

Which of the following is incorrect?

54 / 60

What will be the output of the following Python code?

>>>list1 = [1, 3]
>>>list2 = list1
>>>list1[0] = 4
>>>print(list2)

55 / 60

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

56 / 60

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

print("%.2f"%x)

 

 

57 / 60

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

a='hello'
q=10
vars()

 

58 / 60

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

59 / 60

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

60 / 60

What will be the output of the following Python code?

for i in range(int(2.0)):
    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.