-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquestions.txt
More file actions
180 lines (120 loc) · 4.76 KB
/
questions.txt
File metadata and controls
180 lines (120 loc) · 4.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# Beginner Coding Practice Set (Level 2 → 3)
This set contains **30 beginner-friendly coding questions** across:
- Algorithms (10)
- Data Structures (10)
- Basic CS / Logic Problems (10)
---
## ⭐ Algorithms (10 Problems)
1. **Sum of Array Elements**
Write a program that takes an array of numbers and returns the sum of all elements.
2. **Find the Largest Number**
Given an array of integers, return the maximum number.
3. **Count Even and Odd Numbers**
Given a list of integers, count how many are even and how many are odd.
4. **Reverse a Number**
Write a program to reverse the digits of a given integer.
Example: `1234 → 4321`
5. **Check Palindrome Number**
Check if a number reads the same forward and backward.
6. **Factorial of a Number**
Write a function that returns `n!` (factorial of n).
7. **Fibonacci Sequence (First N Terms)**
Print the first `N` numbers of the Fibonacci sequence.
8. **Linear Search**
Search for a target value inside an array and return its index (or `−1`).
9. **Count Occurrence of a Number**
Given an array and a value, count how many times the value appears.
10. **Check Prime Number**
Write a program to check if a number is prime.
---
## ⭐ Data Structures (10 Problems)
1. **Insert into an Array**
Insert a value at a given index in an array.
2. **Delete from an Array**
Remove an element at a given index.
3. **Find Length of Array (Without Built-in Length)**
Count the number of elements manually.
4. **Stack Implementation (Push & Pop)**
Simulate a stack using an array.
5. **Queue Implementation (Enqueue & Dequeue)**
Simulate a queue using an array.
6. **Reverse an Array**
Reverse the elements of an array in-place.
7. **Find Second Largest Element**
Return the second highest number in an array.
8. **Check if Array is Sorted**
Return true if elements are in increasing order.
9. **Merge Two Sorted Arrays**
Combine two sorted arrays into one sorted array.
10. **Find Duplicate Elements in an Array**
Print all numbers that appear more than once.
---
## ⭐ Basic Computer Science / Logic Problems (10)
1. **Swap Two Numbers (Without Using Third Variable)**
Swap the values of two variables.
2. **Count Digits in a Number**
Return how many digits a number has.
3. **Sum of Digits of a Number**
Example: `123 → 1+2+3 = 6`
4. **Find ASCII Value of a Character**
Input → character
Output → ASCII code
5. **Convert Lowercase to Uppercase**
Example: `"a" → "A"`
6. **Simple Calculator**
Take two numbers and an operator (`+ − * /`) and compute the result.
7. **Grade Calculator**
Take marks and print grade: `A/B/C/D/Fail`.
8. **Print Multiplication Table**
Example: print the table of `5`.
9. **Check if a Year is Leap Year**
Return true/false.
10. **Count Vowels in a String**
Given a string, count how many vowels it contains.
---
NOOBS
# Super-Beginner Mixed Coding Questions (Level 1–2)
1. **Add Two Numbers From Input**
Take two numbers as input and print their sum.
2. **Check If Number Is Even or Odd**
Input a number and print `Even` or `Odd`.
3. **Check If Two Numbers Are Equal**
Input 2 numbers.
Print `Equal` or `Not Equal`.
4. **Find the Smallest of Three Numbers**
Input 3 numbers and print the smallest one.
5. **Input an Array and Print It**
Read `N`, then read `N` numbers into an array and print them.
6. **Check If a Number Exists in an Array**
Input array + a number.
Print `Found` or `Not Found`.
7. **Pass or Fail**
Input marks.
If marks ≥ 40 → `Pass`, otherwise `Fail`.
8. **Count How Many Times Zero Appears in an Array**
Given an array, count all the zeros.
9. **Add All Numbers From 1 to N**
Given `N`, find the sum `1 + 2 + ... + N`.
10. **Check Positive, Negative or Zero**
Input a number.
Print `Positive`, `Negative`, or `Zero`.
11. **Find the First and Last Element of an Array**
Input an array and print its first and last elements.
12. **Replace All Negative Numbers With Zero in an Array**
Modify the array.
13. **Check If Character Is a Digit**
If input is 0–9 → print `Digit`, else `Not Digit`.
14. **Find the Larger of Two Numbers**
Input 2 numbers and print the bigger one.
15. **Count Spaces in a Sentence**
Input a sentence and count the spaces.
16. **Sum of First 3 Numbers**
Read 3 numbers and print their total.
17. **Check If Number Is a Multiple of 5**
Print `Yes` if it is, else `No`.
18. **Count How Many Elements in Array Are Greater Than 10**
Return the count.
19. **Check If String Is Empty**
If length is 0 → print `Empty`.
20. **Multiply Two Numbers Without Using * Operator**
Use repeated addition.