[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. Pascal Case
Each word starts with a capital letter:

3 / 40

3.

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

4 / 40

4. A variable name cannot start with a number

5 / 40

5. Most recent major version of Python is Python 3

6 / 40

6.

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

7 / 40

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

8 / 40

8. Python can be install on both  Linux and  Windows

9 / 40

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

10 / 40

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

11 / 40

11. python has two primitive loop commands:

  • while loops
  • for loops

12 / 40

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

13 / 40

13. 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()

 

14 / 40

14. A variable name must start with a letter or the underscore character

15 / 40

15. Python relies on indentation?

16 / 40

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

17 / 40

17.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

18 / 40

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

19 / 40

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

20 / 40

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

21 / 40

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

22 / 40

22.

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

23 / 40

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

24 / 40

24. Comments starts with a #

25 / 40

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

26 / 40

26.

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.

27 / 40

27. Which of the following character is used to give single-line comments in Python?
a) //
b) #
c) !
d) /*

28 / 40

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

29 / 40

29.  ________ in Python is a counter-controlled loop.

a) for

b) while

c) Both (a) and (b)

d) None of the above

30 / 40

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

31 / 40

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

32 / 40

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

33 / 40

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

34 / 40

34.

What is the data type of print(type(0xFF))

35 / 40

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

36 / 40

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

37 / 40

37.

Which function overloads the >> operator?

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

38 / 40

38. Comments can be used to explain Python code.

39 / 40

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

40 / 40

40. When does the else statement written after loop executes?

a) When loop condition becomes false

b) When break statement is executed in the loop

c) else statement is always executed

d) None of the above

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.