[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

Which is the correct operator for power(xy)?

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

2 / 40

2. We can combine strings and numbers by using the format() method

3 / 40

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

4 / 40

4.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

5 / 40

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

6 / 40

6.

Which of the following is not a keyword in Python language?

  1. val
  2. raise
  3. try
  4. with

7 / 40

7.

 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.

8 / 40

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

9 / 40

9.

Which of the following statements assigns the value 25 to the variable x in Python:

  1. x ← 25
  2. x = 25
  3. x := 25
  4. int x = 25
  5. x << 25

10 / 40

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

11 / 40

11.

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

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

12 / 40

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

13 / 40

13. During Installation Make sure to select both the checkboxes at the bottom .

14 / 40

14. Which term describes a loop that continues repeating without a terminating (ending) condition?

a) Infinite Loop

b) Conditional Loop

c) Unlimited Loop

d) Sequence Loop

15 / 40

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

16 / 40

16.

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

17 / 40

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

18 / 40

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

19 / 40

19. You can use the pop() method to remove an element from the array

20 / 40

20.

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

21 / 40

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

22 / 40

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

23 / 40

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

24 / 40

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

25 / 40

25. The format() method takes the passed arguments

26 / 40

26. You can also have an else without the elif

27 / 40

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

28 / 40

28.

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

29 / 40

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

30 / 40

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

31 / 40

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

32 / 40

32.

What will be the output of above Python code?

str1="6/4"print("str1")

A. 1
B. 6/4
C. 1.5
D. str1

33 / 40

33. Python has various versions available

34 / 40

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

35 / 40

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

36 / 40

36. Python can be install on both  Linux and  Windows

37 / 40

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

38 / 40

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

39 / 40

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

40 / 40

40.

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.

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.