[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. python file can also run on command line

3 / 40

3.

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

4 / 40

4.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

5 / 40

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

6 / 40

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

7 / 40

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

8 / 40

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

9 / 40

9.

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.

10 / 40

10.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

11 / 40

11.

What will be the output of below Python code?

str1="Information"print(str1[2:8])

A. format
B. formatio
C. orma
D. ormat

12 / 40

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

13 / 40

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

14 / 40

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

15 / 40

15.

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.

16 / 40

16. An array can hold many values under a single name

17 / 40

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

a. 5

b. 3

c. 6

d. 7

18 / 40

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

19 / 40

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

20 / 40

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

21 / 40

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

22 / 40

22. Which of the following is the use of function in python?
a) Functions are reusable pieces of programs
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the mentioned

23 / 40

23.

What is the value of the expression 100 / 25?

  1. 4
  2. 4.0
  3. 0
  4. 25

24 / 40

24.

What will be the output of below Python code?

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

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

25 / 40

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

26 / 40

26. Find the output of the given Python program?

a = 25if a < 15:    print("Hi")if a <= 30:    print("Hello")else:    print("Know Program")

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

27 / 40

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

28 / 40

28.

Which function overloads the >> operator?

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

29 / 40

29. Python can be used to handle big data and perform complex mathematics.

30 / 40

30. What will be the output of the following Python code?

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

a) 1 2
b) 1 2 3
c) error
d) none of the mentioned

31 / 40

31. Operators are used to perform operations on variables and values

32 / 40

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

33 / 40

33. Python has various versions available

34 / 40

34.

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

35 / 40

35. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

36 / 40

36. The format() method takes the passed arguments

37 / 40

37. Comments starts with a #

38 / 40

38. A variable name cannot start with a number

39 / 40

39. python has two primitive loop commands:

  • while loops
  • for loops

40 / 40

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

 

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.