MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING
(A Unit of Rajalaxmi Education Trust ®, Mangalore)
Autonomous Institute affiliated to VTU, Belagavi , Approved by AICTE, New Delhi
Accredited by NAAC with A+ Grade & ISO 9001:2015 Certified Institution
PROGRAMMING PRACTICE QUESTIONS
Basic programming practice problems. These are intentionally simple, so students come prepared and Day-1
can focus on speed, correctness, and edge cases.
Basic Input/Output & Warm-up (i–x)
i. Read an integer and print it.
ii. Read two integers and print their sum.
iii. Read two integers and print their difference.
iv. Read two integers and print their product.
v. Read two integers and print quotient and remainder.
vi. Read a character and print its ASCII value.
vii. Read an ASCII value and print the character.
viii. Read a float and print it with 2 decimal places.
ix. Read a string and print it.
x. Read three numbers and print their average.
100 Basic Programming Practice Problems (No Trivial I/O)
Purpose: Pre-training self-preparation for VI Semester students
Focus: Logic building, loops, conditions, arrays, strings, basic DSA thinking
A. Conditional Logic & Basic Reasoning (1–20)
1. Check whether a number is even or odd without using % operator.
2. Check if a number is positive, negative, or zero.
3. Find the larger of two numbers without using comparison operators.
4. Find the largest of three numbers using minimum comparisons.
5. Check if a year is a leap year.
6. Check whether a number is divisible by both 3 and 5.
7. Check if a character is a vowel or consonant.
8. Check whether a character is uppercase or lowercase.
9. Check if a number lies between two given numbers.
10. Check whether a triangle is valid based on side lengths.
11. Identify whether a triangle is equilateral, isosceles, or scalene.
12. Check if a number ends with digit 5 or 0.
13. Check if two numbers have the same last digit.
14. Check if a number is a multiple of another number.
15. Determine eligibility for voting based on age.
16. Check if a number is divisible by 4 but not by 8.
17. Find absolute value of a number without using library function.
18. Check if a character is alphabet, digit, or special character.
19. Compare two strings and check if they are equal (manual).
20. Check if a number is within a given inclusive range.
MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING
(A Unit of Rajalaxmi Education Trust ®, Mangalore)
Autonomous Institute affiliated to VTU, Belagavi , Approved by AICTE, New Delhi
Accredited by NAAC with A+ Grade & ISO 9001:2015 Certified Institution
B. Loop-Based Logic & Number Operations (21–45)
21. Print all numbers from 1 to N that are divisible by 3.
22. Print all numbers from 1 to N that are divisible by both 2 and 3.
23. Count digits in a number.
24. Find the sum of digits of a number.
25. Find the product of digits of a number.
26. Reverse a number.
27. Check if a number is palindrome.
28. Find factorial of a number.
29. Print Fibonacci series up to N terms.
30. Find the nth Fibonacci number.
31. Find the largest digit in a number.
32. Find the smallest digit in a number.
33. Count how many digits are even in a number.
34. Count how many digits are odd in a number.
35. Find the sum of even digits in a number.
36. Print multiplication table of a given number.
37. Print all factors of a number.
38. Count number of factors of a number.
39. Check if a number is prime.
40. Print all prime numbers up to N.
41. Find sum of prime numbers up to N.
42. Find GCD of two numbers.
43. Find LCM of two numbers.
44. Check if a number is a perfect number.
45. Check if a number is an Armstrong number (3-digit).
C. Pattern-Based Logic (46–60)
46. Print a square star pattern of size N.
47. Print a right-angled triangle star pattern.
48. Print an inverted right triangle star pattern.
49. Print a number triangle (1, 12, 123…).
50. Print repeated number triangle (1, 22, 333…).
51. Print Floyd’s triangle.
52. Print a hollow square star pattern.
53. Print a pyramid star pattern.
54. Print inverted pyramid pattern.
55. Print a diamond pattern.
56. Print a binary triangle (0/1 pattern).
57. Print a pattern of alternate 1s and 0s.
58. Print a number pyramid (palindrome).
59. Print pattern using increasing alphabets.
60. Print pattern using decreasing alphabets.
MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING
(A Unit of Rajalaxmi Education Trust ®, Mangalore)
Autonomous Institute affiliated to VTU, Belagavi , Approved by AICTE, New Delhi
Accredited by NAAC with A+ Grade & ISO 9001:2015 Certified Institution
D. Arrays – Very Basic but Interview-Relevant (61–80)
61. Read an array and print all elements.
62. Find sum of array elements.
63. Find maximum element in an array.
64. Find minimum element in an array.
65. Count even and odd numbers in an array.
66. Count positive, negative, and zero elements.
67. Find second largest element in an array.
68. Find second smallest element in an array.
69. Reverse an array in-place.
70. Check if an array is sorted.
71. Find the index of a given element (linear search).
72. Count frequency of a given element.
73. Replace all negative numbers with zero.
74. Find sum of elements at even indices.
75. Find sum of elements at odd indices.
76. Rotate array left by one position.
77. Rotate array right by one position.
78. Copy elements of one array into another.
79. Merge two arrays into a third array.
80. Find common elements between two arrays (simple).
E. Strings – Basic Interview-Level Problems (81–100)
81. Find length of a string without using library function.
82. Count vowels in a string.
83. Count consonants in a string.
84. Count digits in a string.
85. Count spaces in a string.
86. Reverse a string.
87. Check if a string is palindrome.
88. Convert lowercase characters to uppercase manually.
89. Convert uppercase characters to lowercase manually.
90. Count frequency of a given character in a string.
91. Count frequency of each character in a string.
92. Remove all spaces from a string.
93. Replace spaces with a hyphen (-).
94. Check if two strings are anagrams (lowercase only).
95. Find first non-repeating character in a string.
96. Find first repeating character in a string.
97. Count words in a string.
98. Reverse words in a sentence.
99. Check if a string contains only digits.
100. Check if a string contains only alphabets.
MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING
(A Unit of Rajalaxmi Education Trust ®, Mangalore)
Autonomous Institute affiliated to VTU, Belagavi , Approved by AICTE, New Delhi
Accredited by NAAC with A+ Grade & ISO 9001:2015 Certified Institution
DBMS Practice Questions (Simple & Interview-Ready)
A. Conceptual DBMS Questions (1–10)
1. What is the difference between DBMS and RDBMS?
2. What is a primary key? Can a table have more than one primary key?
3. What is the difference between primary key and unique key?
4. What is a foreign key? Why is it used?
5. What is normalization? Why is it required?
6. What are the different normal forms? Name them.
7. What is the difference between DELETE, TRUNCATE, and DROP?
8. What is an index? Why do we use indexing?
9. What is referential integrity?
10. What are ACID properties? Explain briefly.
B. Simple SQL Query Practice (11–20)
Assume the following tables:
STUDENT (sid, name, dept, year, cgpa)
COURSE (cid, cname, dept)
ENROLLMENT (sid, cid, semester)
11. Display all records from the STUDENT table.
12. Display names of students belonging to the ‘CSE’ department.
13. Find students whose CGPA is greater than 8.0.
14. Display distinct departments from the STUDENT table.
15. Count the total number of students.
16. Display students sorted by CGPA in descending order.
17. Find the average CGPA of students.
18. Display students whose names start with the letter ‘A’.
19. Find students who are in 3rd year.
20. Display student names along with course names they are enrolled in (simple JOIN).