[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Comparison operators are not  used to compare two values

2 / 40

2.

In a program, a function can be called ____________ times.

a. 2

b. 3

c. 5

d. Multiple times

3 / 40

3. You can have if statements inside if statements, this is called nested if statements.

4 / 40

4.

Python considered the character enclosed in triple quotes as String.(T/F)

a. True

b. False

5 / 40

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

6 / 40

6. The len() method to return the length of an array

7 / 40

7.

What is the data type of print(type(10))

8 / 40

8. Variables that are created outside of a function

9 / 40

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

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

a) Hi
b) Know Program

c)
Hi
Hello

d)
Know Program
Hello

10 / 40

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

11 / 40

11. You can also use the remove() method to remove an element from the array

12 / 40

12.

Function defined to achieve some task as per the programmer’s requirement is called a ___________

a. user defined function

b. library function

c. built in functions

d. All of the above.

13 / 40

13. Is Python code compiled or interpreted?
a) Python code is both compiled and interpreted
b) Python code is neither compiled nor interpreted
c) Python code is only compiled
d) Python code is only interpreted

14 / 40

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

15 / 40

15. X wants to allow the program to repeatedly ask the user to enter their Choice if it does not equal the Answer. Which loop option should X use?

a) while Choice == Answer:

Choice = input()

b) while Choice != Answer:

Choice = input()

c) while Answer != Choice:

Choice = input()

d) while Answer =! Choice:

Choice = input()

 

16 / 40

16.

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

a. [ ]

b. { }

c. ( )

d. None of the above

17 / 40

17. Strings in python are surrounded by either single quotation marks, or double quotation marks

18 / 40

18.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

19 / 40

19. Python has various versions available

20 / 40

20. Python will give you an error if you skip the indentation

21 / 40

21. Which of the following is used to define a block of code in Python language?
a) Indentation
b) Key
c) Brackets
d) All of the mentioned

22 / 40

22.

Which is the correct operator for power(xy)?

  1. X^y
  2. X**y
  3. X^^y
  4. None of the mentioned

23 / 40

23. Python can be install on both  Linux and  Windows

24 / 40

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

25 / 40

25.

 Select the correct example of complex datatype in Python

  1. 3 + 2j
  2. -100j
  3. 5j
  4. All of the above are correct

26 / 40

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

27 / 40

27. What does the following code print?

x = -10if x < 0:    print("The negative number ",  x, " is not valid here.")print("This is always printed")
a.This is always printedb.The negative number -10 is not valid hereThis is always printedc.The negative number -10 is not valid here

28 / 40

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

29 / 40

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

30 / 40

30. The list’s remove() method only removes the first occurrence of the specified value.

31 / 40

31. Comments can’t be used to prevent execution when testing code.

32 / 40

32. Is there any comments in  following codes

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

 

33 / 40

33.

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

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

34 / 40

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

35 / 40

35.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

36 / 40

36. break in Python is used ______________

a) To restart a loop

b) Terminate a loop

c) To jump in between the loop

d) None of the above

37 / 40

37. You have to use the same number of spaces in the same block of code, otherwise Python will give you an error

38 / 40

38.

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

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

39 / 40

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

40 / 40

40. You can use the append() method to add an element to an array

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.