[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

3. Python has syntax that allows developers to write programs with fewer lines than some other programming languages.

4 / 40

4.

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

5 / 40

5.

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

a. Define

b. DEF

c. def

d. Def

6 / 40

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

7 / 40

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

8 / 40

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

9 / 40

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

10 / 40

10.

 ____________________ 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

11 / 40

11.

 What is output of: 35 == 35.0

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

12 / 40

12. Python can be install on both  Linux and  Windows

13 / 40

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

14 / 40

14. Is there any comments in  following codes

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

 

15 / 40

15.

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

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

16 / 40

16. An array is a special variable, which can hold more than one value at a time

17 / 40

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

18 / 40

18.

How to copy one list to another in python?

A. l1[] = l2[]
B. l1[] = l2
C. l1[] = l2[:]
D. l1 = l2

19 / 40

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

20 / 40

20.

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

a. 2

b. 3

c. 5

d. Multiple times

21 / 40

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

22 / 40

22. You can also have multiple else statements on the same line:

23 / 40

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

24 / 40

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

25 / 40

25. Which of the following is a Python tuple?
a) [1, 2, 3]
b) (1, 2, 3)
c) {1, 2, 3}
d) {}

26 / 40

26. Which of the following is False regarding loops in Python?

a)Loops are used to perform certain tasks repeatedly.

b) while loop is used when multiple statements are to executed repeatedly until the given condition becomes true.

c) while loop is used when multiple statements are to executed repeatedly until the given condition becomes false.

d) for loop can be used to iterate through the elements of lists.

27 / 40

27.

In the Python statement x = a + 5 – b:

a and b are ________a + 5 - b is ________
  1. terms, a group
  2. operators, a statement
  3. operands, an expression
  4. operands, an equation

28 / 40

28. Extension of all Python  Programme are .py

29 / 40

29.

What will be the output of above Python code?

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

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

30 / 40

30. Snake Case
Each word is separated by an underscore character:

31 / 40

31. Comments can be used to explain Python code.

32 / 40

32. The format() method takes the passed arguments

33 / 40

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

34 / 40

34.

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.

35 / 40

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

36 / 40

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

37 / 40

37. break in Python is used ______________

a) To restart a loop

b) Terminate a loop

c) To jump in between the loop

d) None of the above

38 / 40

38.

Which is the correct operator for power(xy)?

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

39 / 40

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

40 / 40

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

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.