[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

3. Python can be install on both  Linux and  Windows

4 / 40

4. An example of an illegal character is a double quote inside a string that is surrounded by double quotes

5 / 40

5. What keyword would you use to add an alternative condition to an if statement?

a) else if
b) elseif
c) elif
d) None of the above

6 / 40

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

7 / 40

7. Arithmetic operators are used with numeric values to perform common mathematical operations

8 / 40

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

9 / 40

9.

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

10 / 40

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

a. 5

b. 3

c. 6

d. 7

11 / 40

11. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

12 / 40

12. You can also have multiple else statements on the same line:

13 / 40

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

14 / 40

14. Arrays are used to store multiple values in one single variable.

15 / 40

15. Python can connect to database systems.

16 / 40

16.

What will the below Python code will return?

If str1="save paper,save plants"str1.find("save")

A. It returns the first index position of the first occurance of “save” in the given string str1.
B. It returns the last index position of the last occurance of “save” in the given string str1.
C. It returns the last index position of the first occurance of “save” in the given string str1.
D. It returns the first index position of the first occurance of “save” in the given string str1.

17 / 40

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

18 / 40

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

19 / 40

19. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

20 / 40

20. Indentation refers to the spaces at the beginning of a code line.

21 / 40

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

22 / 40

22.

Which of the following statement will execute in last?

def s(n1): #Statement 1      print(n1) #Statement 2n2=4 #Statement 3s(n2) #Statement 4

a. Statement 1

b. Statement 2

c. Statement 3

d. Statement 4

23 / 40

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

24 / 40

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

25 / 40

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

26 / 40

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

27 / 40

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

28 / 40

28.

In Python, a variable may be assigned a value of one type, and then later assigned a value of a different type:

  1. False
  2. True

29 / 40

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

30 / 40

30. Most recent major version of Python is Python 3

31 / 40

31.

What will be the output of below Python code?

str1="poWer"str1.upper()print(str1)

A. POWER
B. Power
C. power
D. poWer

32 / 40

32.

Which function overloads the >> operator?

  1. more()
  2. gt()
  3. ge()
  4. None of the above

33 / 40

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

34 / 40

34.

 Which of the following statement is False?

  1. Variable names can be arbitrarily long.
  2. They can contain both letters and numbers.
  3. Variable name can begin with underscore.
  4. Variable name can begin with number.

35 / 40

35. Comparison operators are not  used to compare two values

36 / 40

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

37 / 40

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

38 / 40

38.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

39 / 40

39. You can also have an else without the elif

40 / 40

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

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.