0% found this document useful (0 votes)
7 views1 page

Database and Programming Tasks Guide

Uploaded by

paudelpratik921
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)
7 views1 page

Database and Programming Tasks Guide

Uploaded by

paudelpratik921
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

Create 3 related tables:​

Student(StudentID, Name, Department)​


Course(CourseID, CourseName, Credits)​
Enrollment(EnrollID, StudentID, CourseID, Grade)​

Set up:​
StudentID in Enrollment → foreign key referencing Student(StudentID)​
CourseID in Enrollment → foreign key referencing Course(CourseID)​

Insert sufficient data (at least):​


4 students​
3 courses​
6 enrollments (some students enrolled in multiple courses)​

Write JOIN Queries:​


List the names of students along with the course names they are enrolled in.​
List students who are enrolled in a course with more than 3 credits.​
List all courses with the number of students enrolled in each.​

Find students who are not enrolled in any course (Hint: Use NOT IN or LEFT JOIN with NULL
check).​
Write a query to find the courses taken by students in the CS department only.​

Recursion – Palindrome Checker​


Write a recursive function that:​
Takes an integer and checks if it is a palindrome (e.g., 121, 12321).​

Recursive Fibonacci (Without Array)​


Write a recursive function int fibonacci(int n) to return the nth Fibonacci number.​

Logic – Number to Words (Only 1–9)​


Write a program that converts a number like 123 to: One Two Three
Use switch-case inside a loop (don’t use an array of strings).​

Debug the Following Program (4 errors):​


#include <stdio.h>
int main() {
int n;
printf("Enter number: ");
scanf("%d", n);
if n % 2 == 0
​ printf("Even");
else
printf("Odd")
return 0
}

You might also like