This Python Programming Free Certificate is designed to help you assess your knowledge of basic Python knowledge. This is also a useful resource for employers to examine the Python Programming Certificate knowledge of the candidates during an interview or for applicants. If you pass this test with 80% or above (16 question or more), it is likely that you have a pretty solid fundamental knowledge of Python Programming.
Q.1. Which of these in not a core data type? *
- Lists
- Dictionary
- Tuples
- Class
Q.2. What is the output of following program after executing a(1, 2): def add_numbers(x, y): return x – y a = add_numbers *
- -1
- 3
- 1
- none of the mentioned
Q.3. What is the maximum possible length of an identifier? *
- 31 characters
- 63 characters
- 79 characters
- none of the mentioned
Q.4. Which of the following is not a keyword? *
- eval
- assert
- nonlocal
- pass
Q.5. The output of the expressions x.append(3.3) where x = [1, ‘a’, 2, ‘b’] *
- [1, ‘a’, 2, ‘b’, 3.3]
- [‘1’, ‘a’, ‘2’, ‘b’, ‘3.3’]
- [1, a, 2, b, 3.3]
- error
Q.6. What is the output: type(None) *
- function
- NoneType
- error
- none of these
Q.7. Which of the following is the truncation division operator? *
- /
- %
- //
- |
Q.8. What will be the output of the following Python expression if X=345? print(“%06d”%X) *
- 345000
- 000345
- 000000345
- 345000000
Q.9. What will be the output of the following Python code? ‘%s’ %((1.23,),) *
- ‘(1.23,)’
- 1.23,
- (,1.23)
- ‘1.23’
Q.10. What will be the output of the following Python statement? >>>”a”+”bc” *
- a
- bc
- bca
- abc
Q.11. To remove string “hello” from list1, we use which command? *
- list1.remove(“hello”)
- list1.remove(hello)
- list1.removeAll(“hello”)
- list1.removeOne(“hello”)
Q.12. The character Dot (that is, ‘.’) in the default mode, matches any character other than __ *
- caret
- ampersand
- percentage symbol
- newline
Q.13. The expression a{5} will match ______characters with the previous regular expression. *
- 5 or less
- exactly 5
- 5 or more
- exactly 4
Q.14. Which of the following functions results in case insensitive matching? *
- re.A
- re.U
- re.I
- re.X
Q.15. _ represents an entity in the real world with its identity and behaviour *
- A method
- An object
- A class
- An operator
Q.16. __ is used to create an object *
- class
- constructor
- User-defined functions
- In-built functions
Q.17. What is setattr() used for? *
- To access the attribute of the object
- To set an attribute
- To check if an attribute exists or not
- To delete an attribute
Q.18. Which of the following best describes polymorphism? *
- Ability of a class to derive members of another class as a part of its own definition
- Means of bundling instance variables and methods in order to restrict access to certain class members
- Focuses on variables and passing of variables to functions
- Allows for objects of different types and behaviour to be treated as the same general type
Q.19. What is the use of duck typing? *
- More restriction on the type values that can be passed to a given method
- No restriction on the type values that can be passed to a given method
- Less restriction on the type values that can be passed to a given method
- Makes the program code smaller
Q.20. What is the output of: type(1.0) *
- int
- float
- function
- error