[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

3. The format() method takes the passed arguments

4 / 40

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

5 / 40

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

6 / 40

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

7 / 40

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

8 / 40

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

9 / 40

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

10 / 40

10. The else keyword catches anything which isn’t caught by the preceding conditions.

11 / 40

11. Extension of all Python  Programme are .py

12 / 40

12.

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.

13 / 40

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

14 / 40

14.

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

a. True

b. False

15 / 40

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

16 / 40

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

17 / 40

17. Is there any comments in  following codes

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

 

18 / 40

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

19 / 40

19.

How to copy one list to another in python?

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

20 / 40

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

21 / 40

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

22 / 40

22.

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

23 / 40

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

24 / 40

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

25 / 40

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

26 / 40

26.

What will be the output of below Python code?

str1="Information"print(str1[2:8])

A. format
B. formatio
C. orma
D. ormat

27 / 40

27.

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

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

28 / 40

28. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

29 / 40

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

30 / 40

30. The for loop does not require an indexing variable to set beforehand

31 / 40

31. Snake Case
Each word is separated by an underscore character:

32 / 40

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

33 / 40

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

34 / 40

34. python file can also run on command line

35 / 40

35. Comparison operators are not  used to compare two values

36 / 40

36.

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

a. [ ]

b. { }

c. ( )

d. None of the above

37 / 40

37. Which of the following is False regarding loops in Python?

a)Loops are used to perform certain tasks repeatedly.

b) while loop is used when multiple statements are to executed repeatedly until the given condition becomes true.

c) while loop is used when multiple statements are to executed repeatedly until the given condition becomes false.

d) for loop can be used to iterate through the elements of lists.

38 / 40

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

39 / 40

39. The elif keyword is pythons way of saying “if the previous conditions were not true, then try this condition”.

40 / 40

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

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.