Connect with us

ACADEMICS

OAU CSC 201 Practice Quiz

Published

on

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

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

 

2 / 60

Which type of Programming does Python support?

3 / 60

Which of the following Boolean expressions is not logically equivalent to the other three?

 

4 / 60

In the following Python code, which function is the decorator?

def mk(x):
    def mk1():
        print("Decorated")
        x()
    return mk1
def mk2():
    print("Ordinary")
p = mk(mk2)
p()

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

6 / 60

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

7 / 60

What will be the output of the following Python code?

print("Hello {0[0]} and {0[1]}".format(('foo', 'bin')))Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
b) Error
c) Hello foo and bin
d) None of the mentioned

8 / 60

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

 

9 / 60

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

x = int(43.55+2/2)

10 / 60

What will be the output of the following Python code?

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

11 / 60

What will be the output of the following Python code?

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

 

12 / 60

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

13 / 60

The outcome of a programming activity is a _________

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

15 / 60

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

16 / 60

What will be the output of the following Python code?

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

17 / 60

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

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

 

18 / 60

What will be the output of the following Python code?

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

19 / 60

What will be the output of the following Python code?

'%.2f%s' % (1.2345, 99)

20 / 60

What will be the output of the following Python code?

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

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

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

23 / 60

Which of the following expressions results in an error?

24 / 60

What is the value of the following expression?

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

25 / 60

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

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 the following will run without errors?

28 / 60

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

x & y

 

29 / 60

Which of the following is incorrect?

30 / 60

What data type is the object below?

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

31 / 60

Is Python code compiled or interpreted?

32 / 60

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

33 / 60

What will be the output of the following Python code?

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

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

 

35 / 60

The one’s complement of 110010101 is:

36 / 60

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

print("%5.2f"%x)

 

37 / 60

The following python code can work with ____ parameters.

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

 

 

38 / 60

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

39 / 60

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

x<<2

 

40 / 60

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

apple = mango

 

41 / 60

Select all options that print.

hello-how-are-you

 

42 / 60

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

43 / 60

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

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

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

45 / 60

It is not possible for the two’s complement value to be equal to the original value in any case.

 

46 / 60

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

a='hello'
q=10
vars()

 

47 / 60

What will be the output of the following Python program?

def foo(x):
    x[0] = ['def']
    x[1] = ['abc']
    return id(x)
q = ['abc', 'def']
print(id(q) == foo(q))

48 / 60

All keywords in Python are in _________

49 / 60

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

50 / 60

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

print("%-06d"%x)

 

51 / 60

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

print("%.2f"%x)

 

 

52 / 60

What will be the output of the following Python code?

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

 

53 / 60

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

['hello', 'morning'][bool('')]

 

54 / 60

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

“`grade1 = 80“`

“`grade2 = 90“`

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

55 / 60

The expression

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

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

57 / 60

In flow charts, a terminal is represented with what shape

58 / 60

What will be the output of the following Python code?

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

 

59 / 60

What will be the output of the following Python code?

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

60 / 60

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

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.