[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

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

2 / 40

2.

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

3 / 40

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

4 / 40

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

5 / 40

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

6 / 40

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

7 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

8 / 40

8.

l = [ 4, 8, 9, 2.6, 5 ] is a type of which data type in python?

  1. List
  2. Tuple
  3. Set
  4. None of these

9 / 40

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

10 / 40

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

11 / 40

11.

Which keyword is used to begin the definition of a function?

a. Define

b. DEF

c. def

d. Def

12 / 40

12. Is there any comments in  following codes

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

 

13 / 40

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

14 / 40

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

15 / 40

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

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

19.

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

20 / 40

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

21 / 40

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

22 / 40

22. With the break statement we can stop the loop even if the while condition is true

23 / 40

23.

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

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

24 / 40

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

25 / 40

25.

What will be the output of below Python code?

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

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

26 / 40

26. Who developed Python Programming Language?

27 / 40

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

28 / 40

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

29 / 40

29.

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.

30 / 40

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

31 / 40

31.

 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.

32 / 40

32.

 ____________________ can be defined as a named group of instructions that accomplish a specific task when it is invoked/called.

a. Function

b. Datatype

c. Token

d. Operator

33 / 40

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

34 / 40

34.

 What is output of: 35 == 35.0

  1. False
  2. True
  3. 33
  4. None of the above

35 / 40

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

36 / 40

36.

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.

37 / 40

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

38 / 40

38.

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

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

39 / 40

39. Python relies on indentation?

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.