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

Which of the following expressions results in an error?

2 / 60

What will be the output of the following Python expression?

~100?

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

4 / 60

The following are program elements except

5 / 60

What will be the output of the following Python code?

print('*', "abcde".center(6), '*', sep='')

 

6 / 60

What are the two main types of functions in Python?

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

8 / 60

What will be the output of the following Python code?

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

 

9 / 60

What is the order of precedence in python?

10 / 60

What will be the output of the following Python code?

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

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

11 / 60

What will be the output of the following Python code?

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

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

13 / 60

What will be the output of the following Python code?

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

14 / 60

What will be the output of the following Python code?

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

15 / 60

Which function is called when the following Python program is executed?

f = foo()
format(f)

 

16 / 60

Which of the following Python statements will result in the output: 6?

A = [[1, 2, 3],
     [4, 5, 6],
     [7, 8, 9]]

 

17 / 60

Is Python code compiled or interpreted?

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

19 / 60

What is the value of the following expression?

2+4.00, 2**4.0

 

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

 

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 output of the following Python code?

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

 

23 / 60

The outcome of a programming activity is a _________

24 / 60

Which of the following is the correct extension of the Python file?

25 / 60

Which of the following is an invalid variable?

26 / 60

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

 

27 / 60

What will be the output of the following Python code?

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

28 / 60

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

29 / 60

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

'%d %s %g you' %(1, 'hello', 4.0)

30 / 60

What will be the value of the following Python expression?

4+2**5//10

31 / 60

Which of the following expressions results in an error?

32 / 60

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

X=”san-foundry”
print(“%56s”,X)

33 / 60

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

x<<2

 

34 / 60

What will be the output of the following Python code?

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

35 / 60

What will be the output of the following Python code?

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

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

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

38 / 60

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

39 / 60

What will be the output of the following Python code?

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

40 / 60

What will be the output of the following Python code?

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

41 / 60

What will be the output of the following Python statement?

  1. >>>"a"+bc

 

42 / 60

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

43 / 60

Which one of the following has the same precedence level?

44 / 60

What will be the output of the following Python code?

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

45 / 60

What will be the output of the following Python code?

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

 

46 / 60

What will be the output of the following Python expression?

4^12

47 / 60

What is the result of round(0.5) – round(-0.5)?

48 / 60

What will be the output of the following Python code?

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

49 / 60

What will be the output of the following Python program?

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

 

50 / 60

What will be the value of the following Python expression?

 bin(10-2)+bin(12^4)

51 / 60

Which of the following represents the bitwise XOR operator?

52 / 60

Which of the following variable naming is correct

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

54 / 60

What will be the output of the following Python code?

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

55 / 60

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

56 / 60

Which of the following is incorrect?

57 / 60

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

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

58 / 60

Python was created in what year

59 / 60

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

[] or {}
{} or []

 

60 / 60

What will be the output of the following Python code?

for i in range(float('inf')):
    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