[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

 ____________________ 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

2 / 40

2.

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

3 / 40

3. python has two primitive loop commands:

  • while loops
  • for loops

4 / 40

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

5 / 40

5. Python  was created by Guido van Rossum, and released in 1999.

6 / 40

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

7 / 40

7. Python can be install on both  Linux and  Windows

8 / 40

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

9 / 40

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

10 / 40

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

11 / 40

11.

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

12 / 40

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

13 / 40

13.

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

14 / 40

14. Arithmetic operators are used with numeric values to perform common mathematical operations

15 / 40

15. What keyword would you use to add an alternative condition to an if statement?

a) else if
b) elseif
c) elif
d) None of the above

16 / 40

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

17 / 40

17. Indentation refers to the spaces at the beginning of a code line.

18 / 40

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

19 / 40

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

20 / 40

20. Python can be treated in a procedural way, an object-oriented way or a functional way.

21 / 40

21. Is Python code compiled or interpreted?
a) Python code is both compiled and interpreted
b) Python code is neither compiled nor interpreted
c) Python code is only compiled
d) Python code is only interpreted

22 / 40

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

23 / 40

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

24 / 40

24.

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

a. Define

b. DEF

c. def

d. Def

25 / 40

25. Who developed Python Programming Language?

26 / 40

26. print() function is often used to output variables.

27 / 40

27.

In a program, a function can be called ____________ times.

a. 2

b. 3

c. 5

d. Multiple times

28 / 40

28. What is the index value of ‘i’ in string “Learning”

a. 5

b. 3

c. 6

d. 7

29 / 40

29. Is there any comments in  following codes

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

 

30 / 40

30. Python is an interpreted programming language

31 / 40

31. With the for loop we can execute a set of statements

32 / 40

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

33 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

34 / 40

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

35 / 40

35.

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

36 / 40

36.

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

37 / 40

37.

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.

38 / 40

38.

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

a. [ ]

b. { }

c. ( )

d. None of the above

39 / 40

39. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

40 / 40

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

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.