Skip to main content

Pratical -206 paper solution -3

Full course of c++ programming language

Click here > C++ programming language


Q-1 [A] Write a c program to create structure of employee with members Empid, EmpName, Qualification and EmpSalary by taking input of 5 employees display the employee whose qualification is "MBA" and salary greater than 20000.


#include <stdio.h>

#include <conio.h>

#include <string.h>


struct Employee

{

    int Empid, EmpSalary;

    char EmpName[50];

    char Qualification[50];

};


Void main()

{

    struct Employee emp[5];

    int i;


    for (i = 0; i < 5; i++)

    {

        printf("Enter employee ID: ");

        scanf("%d", &emp[i].Empid);

        printf("Enter employee name: ");

        scanf("%s", emp[i].EmpName);

        printf("Enter employee qualification: ");

        scanf("%s", emp[i].Qualification);

        printf("Enter employee salary: ");

        scanf("%d", &emp[i].EmpSalary);

    }


    printf("\nEmployees with qualification of MBA and salary greater than 20000:\n");

    printf("\nEmpId\tName\tQualification\tSalary\n");

    for (i = 0; i < 5; i++)

    {

        if (strcmp(emp[i].Qualification, "MBA") == 0 && emp[i].EmpSalary > 20000)

        {

            printf("\n%d\t%s\t%s\t%d", emp[i].Empid, emp[i].EmpName, emp[i].Qualification, emp[i].EmpSalary);

        }

    }


    getch();

    return 0;

}



Q-1 [B] Write a python program to print sum of N numbers using UDF.


def num(n):

    sum = 0

    for i in range(1, n+1):

        sum += i

    return sum


n = int(input("Enter a number: "))


result = num(n)

print("The sum of first", n, "numbers is:", result)



Q-2 [A] Create following tables with proper constraints and insert atleast 5 records in each Table. 


Course (course id, course name) Student(sno,sname,city,mobile,birth date.course_id) Perform following tasks:


1. Display student's detail with course name. 

2. Display student's detail who belongs to " BCA" course.

3. Display total numbers of student's course_name wise. 

4. Display student's detail as per city in ascending order along with course details. 

5. Display student's detail whose birth__ date is before 2000.


CREATE TABLE Course

(

    course_id number primary key,

    course_name VARCHAR(50) 

);


CREATE TABLE Student 

(

    sno number primary key,

    sname VARCHAR(50) , 

    city VARCHAR(50) , 

    mobile VARCHAR(20) , 

    birth_date DATE, 

    course_id number, 

    Constraint a FOREIGN KEY (course_id) REFERENCES Course(course_id)

);


1. Display student's detail with course name.

    

SELECT s.sno, s.sname, s.city, s.mobile, s.birth_date, c.course_name

FROM Student s 

INNER JOIN Course c ON s.course_id = c.course_id;


2. Display student's detail who belongs to " BCA" course.


SELECT s.sno, s.sname, s.city, s.mobile, s.birth_date

FROM Student s

INNER JOIN Course c ON s.course_id = c.course_id

WHERE c.course_name = 'BCA';


3. Display total numbers of student's course_name wise.


SELECT c.course_name, COUNT(*) as total_students

FROM Student s

INNER JOIN Course c ON s.course_id = c.course_id

GROUP BY c.course_name;


4. Display student's detail as per city in ascending order along with course details. 


SELECT s.sno, s.sname, s.city, s.mobile, s.birth_date, c.course_name

FROM Student s

INNER JOIN Course c ON s.course_id = c.course_id

ORDER BY s.city ASC;


5. Display student's detail whose birth__ date is before 2000.


select * from student where to_char(bdate,'yyyy')<2000;


Comments

Popular posts from this blog

Remove specific item from Recyclerview in android studio

For Full video click on below link :- https://youtu.be/sUz4fqeanjI?si=A8AqBWCgu-5NnBOJ Working with the activity_main.xml file. Navigate to the   app > res > layout > activity_main.xml  and add the below code to that file. Below is the code for the   activity_main.xml   file.  <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:orientation="vertical" android:background="@color/white"> <EditText android:layout_width="350dp" android:layout_height="50dp" android:inputType="text" android:id="@+id/coursenam...

Fingerprint Authentication in Android Studio Project

Implement the implementation : - implementation 'androidx.biometric:biometric:1.0.1' Working with the activity_main.xml file. Navigate to the   app > res > layout > activity_main.xml  and add the below code to that file. Below is the code for the   activity_main.xml   file. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" tools:context=".MainActivity" android:background="@color/white"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Welcome to the Boxcode!!" android:textSize=...

Sqlite with CRUD operation in Android studio

For Full video click on link :- https://youtu.be/QTvy8sJSiyI?si=dM1f98Mr7aFpJpqG Working with the activity_main.xml file. Navigate to the   app > res > layout > activity_main.xml  and add the below code to that file. Below is the code for the   activity_main.xml   file.  <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:orientation="vertical" android:background="@color/white"> <EditText android:layout_width="350dp" android:layout_height="50dp" android:inputType="text" android:id="@+id/coursename...