MCQ
FRQ
Hard
Bonus
100

makefileCopy codex = "Hello" y = "World" print(x + y)

  • a. Hello World
  • b. HelloWorld
  • c. Hello+World
  • d. Error

a. Hello World

100

goCopy codex = 5 y = 2 print(x // y)

The output of the code is 2.

100
  • s= ‘abc’
  • for i in len(s)
  • s[i] = s[i].upper()
  • print(s)

A. The code will cause a runtime exception
B. 123
C. abc
D. ABC

A

100

08. Select the true statements:

(select all that apply)

a) The class keyword marks the beginning of the class definition

b) An object cannot contain any references to other objects

c) A class may define an object

d) A constructor is used to instantiate an object

e) An object variable is a variable that is stored separately in every object

ACD

200

Which of the following is an example of a Boolean value in Certified Associate in Python Programming?

  • a. “Hello”
  • b. 123
  • c. True
  • d. 3.14

D. 3.14


200

scssCopy codemy_list = [2, 5, 3, 7, 1] print(max(my_list))

The output of the code is 7.

200
  • str = ‘abcdef’
  • def fun (s) :
  • del s [2]
  • return s
  • print ( fun(str) )

A. The program will cause a runtime exception/error
B. abcef
C. acdef
D. abdef

D

200

19.) The primary parameter of every method:

A. holds a reference to the presently handled object
B. is constantly set to None
C. is set by the first argument’s value
D. is set to a unique random value

A

300

pythonCopy codex = 10 if x > 5:    print("x is greater than 5") else:    print("x is less than or equal to 5")

  • a. x is greater than 5
  • b. x is less than or equal to 5
  • c. Error
  • d. Nothing is printed

a. x is greater than 5

300

makefileCopy codemy_string = "hello" print(my_string[1:4])

The output of the code is “ell”.

300

What do you think will be t
he simplest class definition in python expressed as?

A. class X:
B. class X: pass
C. class X: return
D. class X: { }

A

300

Is it conceivable to securely check if a class/object has a specific quality?

A. Yes, by utilizing the hasattr attribute
B. Yes, by utilizing the hasattr ( ) method
C. Yes, by utilizing the hassattr ( ) function
D. no, it is unimaginable

C

400

cssCopy codemy_list = [1, 2, 3, 4, 5] for item in my_list:    print(item)

  • a. 1 2 3 4 5
  • b. [1, 2, 3, 4, 5]
  • c. 5 4 3 2 1 d. Error

a. 1 2 3 4 5

400

pythonCopy codex = 10 if x > 5:    print("x is greater than 5") else:    print("x is less than or equal to 5")

The output of the code is “x is greater than 5”.

400

If S is a stream open for reading, what do you expect from the following invocation?

  • A. one line of the file will be read and stored in the string called C
  • B. the whole file content will be read and stored in the string called C
  • C. one character will be read and stored in the string called C
  • D. one disk sector (512 bytes) will be read and stored in the string called C


B

400

A method for passing the arguments used by the following snippet is called:

  • A. sequential
  • B. named
  • C. positional
  • D. keyword
C
500

pythonCopy codedef my_function(x, y):    return x + y
result = my_function(3, 4) print(result)

  • a. 3 4
  • b. 7
  • c. my_function(3, 4)
  • d. Error

b. 7

500

pythonCopy codedef multiply(x, y):    return x * y
result = multiply(3, 4) print(result)

 The output of the code is 12.

500

Assuming that the code below has been executed successfully, which of the following expressions will always evaluate to True? (Choose two.)


  • A. v1 >= 1
  • B. v1 == v2
  • C. len(random.sample([1,2,3],2)) > 2
  • D. random.choice([1,2,3]) >=1


AD

500

What is the expected behavior of the following code?

It will:

  • A. print 0
  • B. cause a runtime exception
  • C. prints 3
  • D. print an empty line


B

M
e
n
u