[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2.

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

3 / 40

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

4 / 40

4. What is the output of the given below program?

if 1 + 3 == 7:    print("Hello")else:    print("Know Program")

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

5 / 40

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

6 / 40

6.

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

7 / 40

7. Which term describes a loop that continues repeating without a terminating (ending) condition?

a) Infinite Loop

b) Conditional Loop

c) Unlimited Loop

d) Sequence Loop

8 / 40

8.

 ____________________ 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

9 / 40

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

10 / 40

10. The elif keyword is pythons way of saying “if the previous conditions were not true, then try this condition”.

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 has a set of built-in methods that you can use on lists/arrays

13 / 40

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

14 / 40

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

15 / 40

15.

Python considered the character enclosed in triple quotes as String.(T/F)

a. True

b. False

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

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

20 / 40

20. Which of the following loop is not supported by the python programming language?

a) for loop

b) while loop

c) do…while loop

d) None of the above

21 / 40

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

22 / 40

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

23 / 40

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

24 / 40

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

25 / 40

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

26 / 40

26. Who developed Python Programming Language?

27 / 40

27. The for loop does not require an indexing variable to set beforehand

28 / 40

28.

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

29 / 40

29.

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.

30 / 40

30.

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.

31 / 40

31.

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

32 / 40

32. Most recent major version of Python is Python 3

33 / 40

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

34 / 40

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

35 / 40

35.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

36 / 40

36. Comments starts with a #

37 / 40

37.

 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.

38 / 40

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

39 / 40

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

40 / 40

40.

Which of the following statement will execute in last?

def s(n1): #Statement 1      print(n1) #Statement 2n2=4 #Statement 3s(n2) #Statement 4

a. Statement 1

b. Statement 2

c. Statement 3

d. Statement 4

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.