[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

Which of the following creates a tuple?

A. tuple1=(“a”,”b”)
B. tuple1[2]=(“a”,”b”)
C. tuple1=(5)*2
D. None of the above

2 / 40

2. Which keyword is used for function?
a) Fun
b) Define
c) Def
d) Function

3 / 40

3.

l = [ 4, 8, 9, 2.6, 5 ] is a type of which data type in python?

  1. List
  2. Tuple
  3. Set
  4. None of these

4 / 40

4. Identity operators are used to compare the objects, not if they are equal, but if they are actually the same object, with the same memory location

5 / 40

5.

What will be the output of below Python code?

tupl=([2,3],"abc",0,9)tupl[0][1]=1print(tupl)A. ([2,3],"abc",0,9)B. ([1,3],"abc",0,9)C. ([2,1],"abc",0,9)D. Error

6 / 40

6. An array can hold many values under a single name

7 / 40

7. You can return a range of characters by using the slice syntax

8 / 40

8. Find and write the output of the following python code:

x = “abcdef”

i = “a”

while i in x:

print(i, end = ” “)

a) a

b) a a a a a a

c) a a a a a a … infinite times

d) Code will generate error

9 / 40

9. With the break statement we can stop the loop before it has looped through all the items

10 / 40

10. The format() method takes unlimited number of arguments

11 / 40

11. Find the output of the following program segments:

for i in range(20,30,2):

print(i)

a) 20 22 24 26 28

b) 20

22

24

26

28

c) 20 22 24 26 28 30

d) 20

22

24

26

28

30

12 / 40

12. python has two primitive loop commands:

  • while loops
  • for loops

13 / 40

13. Which of the following is a Python tuple?
a) [1, 2, 3]
b) (1, 2, 3)
c) {1, 2, 3}
d) {}

14 / 40

14. What is the output of the given below program?

if 1 + 3 == 7:    print("Hello")else:    print("Know Program")

a) Hello
b) Know Program
c) Compiled Successfully, No Output.
d) Error

15 / 40

15.

Which keyword is used to begin the definition of a function?

a. Define

b. DEF

c. def

d. Def

16 / 40

16.

 ____________________ can be defined as a named group of instructions that accomplish a specific task when it is invoked/called.

a. Function

b. Datatype

c. Token

d. Operator

17 / 40

17.

Choose the correct option with respect to Python.

A. Both tuples and lists are immutable.
B. Tuples are immutable while lists are mutable.
C. Both tuples and lists are mutable.
D. Tuples are mutable while lists are immutable.

18 / 40

18. if statements cannot be empty, but if you for some reason have an if statement with no content, put in the pass statement to avoid getting an error

19 / 40

19. Operators are used to perform operations on variables and values

20 / 40

20. Most recent major version of Python is Python 3

21 / 40

21. Python can connect to database systems.

22 / 40

22.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

23 / 40

23. Which term describes a loop that continues repeating without a terminating (ending) condition?

a) Infinite Loop

b) Conditional Loop

c) Unlimited Loop

d) Sequence Loop

24 / 40

24. Comments can be used to make the code more readable.

25 / 40

25. All keywords in Python are in _________
a) Capitalized
b) lower case
c) UPPER CASE
d) None of the mentioned

26 / 40

26. Variables that are created outside of a function

27 / 40

27.

The most important object defined in NumPy is an N-dimensional array type called?

A. ndarray
B. narray
C. nd_array
D. darray

28 / 40

28. Pip is  not a powerful package management system for Python software packages

29 / 40

29. Python can be treated in a procedural way, an object-oriented way or a functional way.

30 / 40

30. Camel Case
Each word, except the first, starts with a capital letter:

31 / 40

31. What is the index value of ‘i’ in string “Learning”

a. 5

b. 3

c. 6

d. 7

32 / 40

32.

 What is output of: 35 == 35.0

  1. False
  2. True
  3. 33
  4. None of the above

33 / 40

33. You can use three double quotes only:

a = “””Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.”””
print(a)

34 / 40

34.

Write the output of the following code :

str = "Welcome"str[2] = 'a'print(str)

a. Weacome

b. Error

c. aWelcome

d. Welcomea

35 / 40

35. Can we write if/else into one line in python?

a) Yes
b) No
c) if/else not used in python
d) None of the above

36 / 40

36. Comments can be used to explain Python code.

37 / 40

37. Bitwise operators are used to compare (binary) numbers

38 / 40

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

39 / 40

39. Python relies on indentation?

40 / 40

40. You can also have an else without the elif

Exit



[hurrytimer id=”2250″]
[wooct_product]

Wrong shortcode initialized


You must log in to see your results.



Wrong shortcode initialized


There are no questions atteched yet.





[ays_quiz_leaderboard id=”Your_Quiz_ID” from=”Y-m-d H:i:sa” to=”Y-m-d H:i:s”]

Category:


Wrong shortcode initialized


[WATU 1]

You must log in to see your results.