C# - C Sharp: CSD203 - PT1


Khóa học qua video:
Lập trình Python All Lập trình C# All SQL Server All Lập trình C All Java PHP HTML5-CSS3-JavaScript
Đăng ký Hội viên
Tất cả các video dành cho hội viên

(nhấn nút 'Result' để biết kết quả)

Q1: What is recursion?
A loop that never ends
A function calling itself
A variable calling itself
A class inheriting itself

Q2: What is the purpose of a base case in recursion?
To increase memory usage
To stop recursive calls
To create infinite recursion
To speed up loops

Q3: What is the output of f(3)?
def f(n):
    if n == 0:
        return 0
    return n + f(n-1)

print(f(3))
3
5
6
9

Q4: What happens if a recursive function has no base case?
It executes once
It returns None
Infinite recursion occurs
It becomes iterative

Q5: Which data structure is mainly used by recursion internally?
Queue
Stack
Linked List
Array

Q6: What is the value of factorial(4)?
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
12
16
24
32

Q7: Which traversal of a tree commonly uses recursion?
BFS
Binary Search
DFS
Hashing

Q8: The time complexity of recursive factorial is:
O(1)
O(log n)
O(n)
O(n²)

Q9: Which statement about recursion is true?
It never uses memory
It can replace some loops
It is always faster than iteration
It cannot solve tree problems

Q10: What will be printed?
def f(n):
    if n == 0:
        return
    print(n)
    f(n-1)

f(3)
1 2 3
3 2 1
3 3 3
1 1 1

Q11: What is the recursion depth for factorial(5)?
4
5
6
10

Q12: Which problem is naturally solved using recursion?
Tree Traversal
Bubble Sort
Linear Search
Array Access

Q13: A stack follows which principle?
FIFO
LIFO
FILO Queue
Random Access

Q14: Which operation inserts an element into a stack?
Pop
Peek
Push
Enqueue

Q15: Which operation removes the top element?
Push
Pop
Peek
Append

Q16: What is the top element after pushing 10 and 20?
s=[]
s.append(10)
s.append(20)
10
20
None
Error

Q17: Which Python list method is commonly used as Push?
insert()
add()
append()
extend()

Q18: What does Peek do?
Deletes top element
Adds element
Views top element
Sorts stack

Q19: Which application uses a stack?
Printer Queue
Browser Back Button
CPU Scheduling
BFS

Q20: What is stack overflow?
Stack becomes empty
Exceeding stack capacity
Queue is full
Memory leak

Q21: Time complexity of Push operation:
O(1)
O(log n)
O(n)
O(n²)

Q22: Which expression notation is evaluated using a stack?
Infix
Prefix
Postfix
Binary

Q23: What is the output of s.pop() if s=[1,2,3]?
s=[1,2,3]
print(s.pop())
1
2
3
Error

Q24: Which traversal uses a stack?
DFS
BFS
Inorder
Level Order

Q25: Queue follows which principle?
LIFO
FIFO
FILO
Random

Q26: Which operation inserts into a queue?
Push
Pop
Enqueue
Peek

Q27: Which operation removes from a queue?
Dequeue
Push
Insert
Add

Q28: Which end receives new elements in a queue?
Front
Rear
Middle
Top

Q29: Which structure is used in BFS?
Stack
Queue
Tree
Heap

Q30: What is the first item removed from queue [10,20,30]?
10
20
30
None

Q31: Which Python module provides an efficient queue?
random
math
collections
os

Q32: Which class is commonly used for queue implementation?
deque
tuple
set
dict

Q33: Time complexity of enqueue operation:
O(1)
O(log n)
O(n)
O(n²)

Q34: Which is a real-world queue example?
Undo operation
Browser history
People waiting in line
Function calls

Q35: What does the front of a queue represent?
Newest element
Next element to remove
Last element
Middle element

Q36: Which traversal uses a queue?
DFS
BFS
Inorder
Postorder

Q37: A singly linked list node contains:
Data only
Data and next pointer
Previous pointer only
Index only

Q38: What is the first node called?
Root
Front
Head
Tail

Q39: What does the last node point to?
Head
Previous node
None
Tail

Q40: Linked lists provide efficient:
Random access
Insertion at beginning
Binary search
Sorting

Q41: Accessing the nth node requires:
O(1)
O(log n)
O(n)
O(n²)

Q42: Which pointer moves to the next node?
prev
next
child
root

Q43: Main disadvantage of linked list:
Dynamic size
Extra memory for pointers
Easy insertion
Flexible growth

Q44: Insertion at head complexity:
O(1)
O(log n)
O(n)
O(n²)

Q45: Deleting the first node complexity:
O(n²)
O(n)
O(log n)
O(1)

Q46: Which operation is slower in a linked list than in an array?
Insert at head
Delete head
Random access
Add node

Q47: Which traversal method is possible in a singly linked list?
Forward only
Backward only
Both directions
Random

Q48: What connects nodes in a linked list?
Index
Pointer/Reference
Array
Loop

Q49: A doubly linked list node contains:
Data only
Data and next
Data, next, previous
Two data fields

Q50: What is an advantage of a doubly linked list?
Less memory
Backward traversal
Faster random access
No pointers

Q51: Which pointer refers to the previous node?
next
head
tail
prev

Q52: Memory usage compared to singly linked list:
Less
Same
More
Zero

Q53: Can a doubly linked list be traversed backward?
No
Yes
Sometimes
Only if sorted

Q54: Last node's next pointer is:
Head
Tail
None
Previous

Q55: First node's prev pointer is:
Head
Tail
Root
None

Q56: Deleting a known node in a doubly linked list is easier because:
No pointers exist
Previous node is directly accessible
It uses arrays
It is sorted

Q57: Which application commonly uses doubly linked lists?
Browser navigation
Binary Search
Selection Sort
Hashing

Q58: Insertion before a node in a doubly linked list is:
Easier than singly linked list
Impossible
Slower than array
O(n²)

Q59: Which statement is true?
Doubly linked lists support bidirectional traversal
They use less memory
They have no pointers
They allow O(1) random access

Q60: Which structure has both next and previous references?
Stack
Queue
Singly Linked List
Doubly Linked List

(Ghi chú: Phần câu hỏi Qi có màu Green thể hiện đáp án đúng)

(Ghi chú: Phần câu hỏi Qi có màu Green thể hiện đáp án đúng)
» Tiếp: PRN212 - PT1
« Trước: Practical 12: Books Management System
Khóa học qua video:
Lập trình Python All Lập trình C# All SQL Server All Lập trình C All Java PHP HTML5-CSS3-JavaScript
Đăng ký Hội viên
Tất cả các video dành cho hội viên
Copied !!!