[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 is the use of function in python?
a) Functions are reusable pieces of programs
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the mentioned

2 / 40

2. Python can be used to handle big data and perform complex mathematics.

3 / 40

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

4 / 40

4.

The function can be called in the program by writing function name followed by ____

a. [ ]

b. { }

c. ( )

d. None of the above

5 / 40

5. To insert characters that are illegal in a string, use an escape character

6 / 40

6.

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

  1. .py
  2. .python
  3. .p
  4. None of these

7 / 40

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

8 / 40

8. Python is an interpreted programming language

9 / 40

9. 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

10 / 40

10. What will be the output of the following Python code?

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

a) [‘ab’, ‘cd’]
b) [‘AB’, ‘CD’]
c) [None, None]
d) none of the mentioned

11 / 40

11.

 ____________________ 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

12 / 40

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

13 / 40

13. An array is a special variable, which can hold more than one value at a time

14 / 40

14. Suppose t = (1, 2, 4, 3), which of the following is incorrect?
a) print(t[3])
b) t[3] = 45
c) print(max(t))
d) print(len(t))

15 / 40

15. Who developed Python Programming Language?

16 / 40

16.

Which of the following is not a keyword in Python language?

  1. val
  2. raise
  3. try
  4. with

17 / 40

17. Python has various versions available

18 / 40

18. A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).

19 / 40

19.

What do we use to define a block of code in Python language?

  1. Key
  2. Brackets
  3. Indentation
  4. None of these

20 / 40

20. The for loop in Python is an _____________

a) Entry Controlled Loop

b) Exit Controlled Loop

c) Both of the above

d) None of the above

21 / 40

21. 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

22 / 40

22. Python can connect to database systems.

23 / 40

23. Python has syntax that allows developers to write programs with fewer lines than some other programming languages.

24 / 40

24. 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

25 / 40

25.

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

26 / 40

26. What will be the output of the following Python code?

  1. d = {"john":40, "peter":45}
  2. d["john"]

a) 40
b) 45
c) “john”
d) “peter”

27 / 40

27.

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.

28 / 40

28. To write and execute code in python, we first need to install Python on our system.

29 / 40

29.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

30 / 40

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

31 / 40

31. Python allows you to extract the values into variables.

32 / 40

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

33 / 40

33.

How to copy one list to another in python?

A. l1[] = l2[]
B. l1[] = l2
C. l1[] = l2[:]
D. l1 = l2

34 / 40

34. With the for loop we can execute a set of statements

35 / 40

35. Which of the following loop is not supported by the python programming language?

a) for loop

b) while loop

c) do…while loop

d) None of the above

36 / 40

36. A variable name can only contain alpha-numeric characters and
underscores

37 / 40

37. What will be the output of the following Python code?

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

a) 1 2
b) 1 2 3
c) error
d) none of the mentioned

38 / 40

38. + operator is used  to get output of multiple variables

39 / 40

39. Official site of python is www.python.org

40 / 40

40. The length of an array is always one more than the highest array index.

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.