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

2 / 60

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

print(“%f”%x)

 

 

3 / 60

What will be the output of the following Python code?

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

4 / 60

What will be the value of the following Python expression?

float(4+int(2.39)%2)

 

5 / 60

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

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

7 / 60

What will be the output of the following Python expression?

~100?

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

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

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

 

 

11 / 60

What will be the output of the following Python function?

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

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

12 / 60

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

x<<2

 

13 / 60

Which one of the following is not a keyword in Python language?

14 / 60

What will be the output of the following Python code?

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

15 / 60

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

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

 

16 / 60

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

17 / 60

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

18 / 60

Which one of the following has the same precedence level?

19 / 60

What will be the output of the following Python code?

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

 

20 / 60

What will be the output of the following Python code?

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

 

21 / 60

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

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

23 / 60

What will be the output of the following Python expression?

round(4.576)

 

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

25 / 60

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

“`grade1 = 80“`

“`grade2 = 90“`

“`average = (grade1 + grade2) / 2“`

26 / 60

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

x = 2
for i in range(x):
    x -= 2
    print (x)

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

28 / 60

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

i. '{0:.2f}'.format(1/3.0)
ii. '%.2f'%(1/3.0)

29 / 60

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

30 / 60

What will be the output of the following Python code?

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

 

31 / 60

What will be the output of the following Python code?

>>>print (r"\nhello")

32 / 60

What will be the output of the following Python code?

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

33 / 60

What is the return type of function id?

34 / 60

Which of the following results in a SyntaxError?

35 / 60

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

36 / 60

The following are high-level languages except

37 / 60

Which of the following expressions results in an error?

38 / 60

Which type of Programming does Python support?

39 / 60

What will be the output of the following Python code?

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

40 / 60

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

print(“%06d”%X)

41 / 60

What will be the output of the following Python code?

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

42 / 60

What will be the output of the following Python code?

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

43 / 60

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

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

45 / 60

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

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

46 / 60

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

47 / 60

What will be the value of the following Python expression?

4 + 3 % 5

 

48 / 60

What will be the output of the following Python code?

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

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

 

50 / 60

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

51 / 60

What are the values of the following Python expressions?

 2**(3**2)
 (2**3)**2
 2**3**2

 

52 / 60

What will be the output of the following Python code?

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

53 / 60

What will be the output of the following Python code if the system date is 21st June, 2017 (Wednesday)?

[] or {}
{} or []

 

54 / 60

What will be the output of the following Python code?

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

55 / 60

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

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

56 / 60

What will be the output of the following Python function?

min(max(False,-3,-4), 2,7)

 

57 / 60

What will be the output of the following Python code?

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

58 / 60

What is the type of inf?

59 / 60

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

a='hello'
q=10
vars()

 

60 / 60

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

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.