[go: up one dir, main page]

0% found this document useful (0 votes)
26 views6 pages

Dolokelen INFO 301 Study Questions

The document contains study questions and programming tasks related to data structures, programming concepts, and Python syntax for an INFO 301 course. It includes multiple-choice questions to test knowledge on Python data types, functions, and control structures. Additionally, there are programming exercises that require manipulating student data and demonstrating understanding of Python programming principles.

Uploaded by

John Kpadeh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views6 pages

Dolokelen INFO 301 Study Questions

The document contains study questions and programming tasks related to data structures, programming concepts, and Python syntax for an INFO 301 course. It includes multiple-choice questions to test knowledge on Python data types, functions, and control structures. Additionally, there are programming exercises that require manipulating student data and demonstrating understanding of Python programming principles.

Uploaded by

John Kpadeh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

INFO 301 Essay Study Questions April 14, 2025

1. What is Data structure?


2. List four data structures in Python
3. What is the essence of loop?
4. What is the difference between Procedural and Object Orientated Programming?
5. Differentiate between Flowchart and Pseudo code
6. What is scope in programming?
7. What is the difference between compile and interpreted programming languages?

Answer All Questions using Python


info301_section_1_students = ['028', '100', '102']
info301_section_2_students = ['001', '002', '003','004', '005', '006']
info301_section_2_pending_students = ['007', '008', '009', '010', '011', '012', '013']

8. Write a program to add info301_section_2_pending_students to


info301_section_1_students; however, if section 2 is full, that is, when the number of
students in section 2 reaches 10 you should add the remaining students to section 1.
9. Assuming that ‘004’ wants to do Add and Drop, write a program to remove him/her from
info301_section_2_students add him/her to info301_section_1_students

Answer All Questions using Python


credit_hour_price = 20
students = {
'001':{'name': 'Emmanuel G. Dolokelen',
'credit_hours': 17,
'fees': credit_hour_price * 17,
'course': ['Info 101', 'Engl 101', 'Math 107', 'Phys 101', 'Fo 100', 'Fren 101'],
'amount_paid': [160, 80, 100]
},
'002':{'name': 'Annie P. Jones',
'credit_hours': 17,
'courses': ['Info 101', 'Engl 101', 'Math 107', 'Phys 101', 'Fo 100', 'Fren 101'],
'fee': credit_hour_price * 17,
'amount_paid': [160, 100, 60]
},
'003':{'name': 'James P. Paye',
'credit_hours': 12,
'courses': ['Info 101', 'Engl 101', 'Phys 101', 'Fo 100', 'Fren 101'],
'fee': credit_hour_price * 13,
'amount_paid': [160, 79]
}
}
1. Write a program that displays the ID and the name of each student informing them whether
they are qualify for the exam, to be qualify, they must not be owing fee.
2. If a student is zero balance, place a ‘clearance’ property to their record and set the
clearance value to ‘Yes’.
3. Write a program that adds ‘Math 107’ to James P. Paye courses and also increase his
existing ‘credit_hours’ by 4.

Multiple Choice Questions

1. Which data type is used to store multiple values in a single variable in Python?
a. int
b. list
c. float

2. What is the result of 5 // 2 in Python?


a. 2.5
b. 3
c. 2

3. What is the output of the following code? print(2 ** 3)


a. 6
b. 8
c. 9

4. Which of the following is a correct way to define a function in Python?


a. def myFunction[]:
b. def myFunction():
c. function myFunction()

5. What does len() function do in Python?


a. Returns the number of elements in a list, string, or tuple
b. Returns the length of a number
c. Returns the last element of a list

6. Which of the following is a mutable data type in Python?


a. tuple
b. list
c. int

7. What is the output of print(type(3.14))?


a. <class 'float'>
b. <class 'int'>
c. <class 'double'>

8. What is the result of 3 * 'abc' in Python?


a. abcabcabc
b. 'abc'
c. TypeError

9. What will my_list = [1, 2, 3]; my_list.append(4) do?


a. Add 4 to the start of the list
b. Add 4 to the end of the list
c. Insert 4 at the second position in the list

10. What does the range() function return in Python?


a. A list of numbers
b. A tuple of numbers
c. A sequence of numbers

11. What is the output of bool(0) in Python?


a. True
b. False
c. 0

12. Which of the following is used to create an empty dictionary in Python?


a. {}
b. []
c. ()

13. What will the following code output? if not 0: print("True")


a. True
b. False
c. No output

14. What does the break keyword do in a loop?


a. Terminates the loop and resumes execution at the next statement
b. Skips the current iteration
c. Continues to the next iteration

15. What is the output of str(123)?


a. "123"
b. 123
c. Error

16. How do you access the first element of a list in Python?


a. my_list.first()
b. my_list[1]
c. my_list[0]

17. What does the continue statement do in a loop?


a. Ends the loop
b. Skips the rest of the current iteration and continues with the next
c. Jumps to the start of the program

18. What is the output of print(type({}))?


a. <class 'list'>
b. <class 'dict'>
c. <class 'tuple'>

19. What will my_tuple = (1, 2, 3); my_tuple[0] = 4 result in?


a. (4, 2, 3)
b. (1, 2, 3)
c. TypeError

20. What will 3 == '3' evaluate to in Python?


a. True
b. False
c. None

21. How do you write a comment in Python?


a. # comment
b. // comment
c. /* comment */

22. What does the pass statement do in Python?


a. Skips the execution of a loop
b. Skips the execution of a class or function
c. Does nothing

23. What will a = [1, 2, 3]; b = a; b[0] = 10; print(a) output?


a. [1, 2, 3]
b. [10, 2, 3]
c. Error

24. How do you create a set in Python?


a. set([])
b. {}

c. set()

25. Which operator is used for string concatenation in Python?


a. +
b. &
c. *

26. Which of the following is a method of the str class in Python?


a. reverse()
b. split()
c. append()

27. What does the global keyword do in Python?


a. It declares a variable as global inside a function
b. It creates a new global variable
c. It imports global variables from other modules

28. What is the output of print(type(None))?


a. <class 'NoneType'>
b. <class 'null'>
c. <class 'None'>

29. Which of the following data structures is immutable?


a. list
b. set
c. tuple

30. What will be the result of my_dict = {1: 'a', 2: 'b'}; my_dict[3]?
a. 'c'
b. None
c. KeyError

31. What is the correct way to convert a string "123" to an integer?


a. int(123)
b. str(123)
c. int("123")

32. Which method can be used to remove the last item from a list in Python?
a. remove()
b. delete()
c. pop()

33. How do you write an infinite loop in Python?


a. while True:
b. while 1:
c. Both a and b

34. Which of the following will throw an IndentationError in Python?


a. Improper indentation
b. Missing function name
c. Incorrect argument type

35. What is the output of my_list = [1, 2, 3]; print(my_list[::-1])?


a. [3, 2, 1]
b. [1, 2, 3]
c. [1, 3, 2]

36. Which of the following is the correct syntax for list comprehension?
a. [x for x in my_list]
b. {x for x in my_list}
c. map(lambda x: x, my_list)

37. What is the output of print(10 == 10.0)?


a. True
b. False
c. TypeError

38. Which of the following functions is used to find the length of a string in Python?
a. length()
b. size()
c. len()

39. What is the result of sum([1, 2, 3]) in Python?


a. 6
b. [1, 2, 3]
c. TypeError

40. What is the output of this code?


num = 0
if num:
print("Fine")
else:
print("Good")
a. Fine
b. Good
c. TypeError

You might also like