PCAP : Certified Associate in Python Programming : Part 01
-
What will be the value of the i variable when the while e loop finishes its execution?
- 1
- 0
- 2
- the variable becomes unavailable
Explanation:
-
And operator able to perform bitwise shifts is coded as (Choose two.)
- —
- ++
- <<
- >>
Explanation:
Reference: https://www.geeksforgeeks.org/basic-operators-python/
-
What will the value of the i variable be when the following loop finishes its execution?
- 10
- the variable becomes unavailable
- 11
- 9
Explanation:Reference: https://www.programiz.com/python-programming/pass-statement -
The following expression
is:
- equal to 1
- invalid
- equal to 2
- equal to -1
Explanation:
-
A compiler is a program designed to (Choose two.)
- rearrange the source code to make it clearer
- check the source code in order to see of it’s correct
- execute the source code
- translate the source code into machine code
-
What is the output of the following piece of code?
- ant’ bat’ camel
- ant”bat” camel
- antbatcamel
- print (a, b, c, sep= ‘ ” ’)
Explanation:
-
What is the expected output of the following snippet?
- the code is erroneous
- 3
- 7
- 15
-
How many lines does the following snippet output?
- three
- one
- two
- four
-
Which of the following literals reflect the value given as 34.23? (Choose two.)
- .3423e2
- 3423e-2
- .3423e-2
- 3423e2
Explanation:
-
What is the expected output of the following snippet?
- 3
- 1
- 2
- the code is erroneous
Explanation:
-
Assuming that the following snippet has been successfully executed, which of the equations are True? (Choose two.)
- len(a) == len (b)
- b [0] +1 ==a [0]
- a [0] == b [0]
- a [0] + 1 ==b [0]
Explanation:
-
Assuming that the following snippet has been successfully executed, which of the equations are False? (Choose two.)
- len(a)== len (b)
- a [0]-1 ==b [0]
- a [0]== b [0]
- b [0] – 1 ==a [0]
Explanation:
-
Which of the following statements are true? (Choose two.)
- Python strings are actually lists
- Python strings can be concatenated
- Python strings can be sliced like lists
- Python strings are mutable
Explanation:Reference: https://docs.python.org/2/tutorial/introduction.html -
Which of the following sentences are true? (Choose two.)
- Lists may not be stored inside tuples
- Tuples may be stored inside lists
- Tuples may not be stored inside tuples
- Lists may be stored inside lists
Explanation:Reference: https://www.afternerd.com/blog/python-lists-for-absolute-beginners/ -
Assuming that String is six or more letters long, the following slice
is shorter than the original string by:
- four chars
- three chars
- one char
- two chars
-
What is the expected output of the following snippet?
- 1
- 4
- 2
- 3
Explanation:
-
What is the expected output of the following snippet?
- abc
- The code will cause a runtime exception
- ABC
- 123
Explanation:
-
How many elements will the list2 list contain after execution of the following snippet?
- zero
- five
- seven
- three
Explanation:
-
What would you used instead of XXX if you want to check weather a certain ‘key’ exists in a dictionary called dict? (Choose two.)
- ‘key’ in dict
- dict [‘key’] != None
- dict.exists (‘key’)
- ‘key’ in dict.keys ( )
Explanation:Reference: https://thispointer.com/python-how-to-check-if-a-key-exists-in-dictionary/ -
You need data which can act as a simple telephone directory. You can obtain it with the following clauses (Choose two.) (assume that no other items have been created before)
- dir={‘Mom’: 5551234567, ‘Dad’: 5557654321}
- dir= {‘Mom’: ‘5551234567’, ‘Dad’: ‘5557654321’}
- dir= {Mom: 5551234567, Dad: 5557654321}
- dir= {Mom: ‘5551234567’, Dad: ‘5557654321’}
Subscribe
0 Comments
Newest