[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. python file can also run on command line

3 / 40

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

4 / 40

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

5 / 40

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

6 / 40

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

7 / 40

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

8 / 40

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

a. 5

b. 3

c. 6

d. 7

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

11 / 40

11.

Which is the correct operator for power(xy)?

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

12 / 40

12.

Which function overloads the >> operator?

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

13 / 40

13.

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

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

14 / 40

14.

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.

15 / 40

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

16 / 40

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

17 / 40

17.

 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.

18 / 40

18. Pascal Case
Each word starts with a capital letter:

19 / 40

19.

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

20 / 40

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

21 / 40

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

22 / 40

22. Variables that are created outside of a function

23 / 40

23.

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

24 / 40

24.

What do we use to define a block of code in Python language?

  1. Key
  2. Brackets
  3. Indentation
  4. None of these

25 / 40

25.

What is the value of the expression 100 / 25?

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

26 / 40

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

27 / 40

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

28 / 40

28. Python is a  high-level programming language.

29 / 40

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

30 / 40

30.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

31 / 40

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

 

32 / 40

32.

Which statement is correct?

A. List is immutable && Tuple is mutable
B. List is mutable && Tuple is immutable
C. Both are Mutable.
D. Both are Immutable

33 / 40

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

34 / 40

34. The format() method takes the passed arguments

35 / 40

35.

What will be the output of above Python code?

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

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

36 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

37 / 40

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

38 / 40

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

39 / 40

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

40 / 40

40. Comments can be used to explain Python code.

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.