[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

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

4 / 40

4. Comparison operators are not  used to compare two values

5 / 40

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

6 / 40

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

7 / 40

7. A variable name cannot start with a number

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. You have to use the same number of spaces in the same block of code, otherwise Python will give you an error

10 / 40

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

11 / 40

11. Variable names are case-sensitive

12 / 40

12. Find the output of the given Python program?

a, b, c = 1, 3, 5if a > 0:  if b < 2:    print("Hi")  elif c > 3:    print("Hello")else:  print("Know Program")

a) Hi
b) Hello
c) Know Program
d) Compiled Successfully, No Output.

13 / 40

13.

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

14 / 40

14. Comments starts with a #

15 / 40

15.

 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.

16 / 40

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

17 / 40

17.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

18 / 40

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

19 / 40

19.

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.

20 / 40

20. Python has a set of built-in methods that you can use on lists/arrays

21 / 40

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

22 / 40

22. Python can be install on both  Linux and  Windows

23 / 40

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

24 / 40

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

25 / 40

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

26 / 40

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

27 / 40

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

28 / 40

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

29 / 40

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

 

30 / 40

30. Comments can be used to explain Python code.

31 / 40

31. Who developed Python Programming Language?

32 / 40

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

33 / 40

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

34 / 40

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

35 / 40

35.

Which of the following is False?

A. String is immutable.
B. capitalize() function in string is used to return a string by converting the whole given string into uppercase.
C. lower() function in string is used to return a string by converting the whole given string into lowercase.
D. None of these.

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. You can also use the remove() method to remove an element from the array

38 / 40

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

39 / 40

39.

Which of the following precedence order is correct in Python?

  1. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
  2. Multiplication, Division, Addition, Subtraction, Parentheses, Exponential
  3. Division, Multiplication, Addition, Subtraction, Parentheses, Exponential
  4. Exponential, Parentheses, Multiplication, Division, Addition, Subtraction

40 / 40

40.

What will be the output of below Python code?

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

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

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.