40 |
41 | Information Science
42 |
43 | AIT
44 | Bangalore
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Autonomous/Sem7/Web Lab/pg10/p10.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
11 |
12 |
--------------------------------------------------------------------------------
/Autonomous/Sem7/Web Lab/pg10/p10.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 |
3 | # Write a Perl program to insert name and age information entered by the user into a table
4 | #created using MySQL and to display the current contents of this table.
5 |
6 |
7 | print "Content-Type: text/html","\n\n";
8 | print "Result of the insert operation ";
9 | use CGI ':standard';
10 | use DBI;
11 |
12 |
13 | #to connect to data base interface with database name “vishal”….login ID as “root”..and password as #“ise123”…
14 | $dbh = DBI->connect("DBI:mysql:pppl","jeffrey","mypass");
15 | $name = param("name"); #to store value from HTML page text box “name”
16 | $age = param("age"); #to store age from HTML page into a variable
17 | $qh = $dbh->prepare("insert into student values('$name','$age')"); # to insert the value into the table #created in the datbase
18 | $qh->execute() or print "error"; #interact with the data base and execute the query following it.
19 | $qh2 = $dbh->prepare("select * from student"); #to retrieve all data from table name “stud” $qh->execute();
20 | $qh2->execute();
21 | print "
Name
Age
";
22 | while (($name, $age) = $qh2->fetchrow_array()) #to display data retrieve from database to the HTML page
23 | {
24 | print "
$name
$age
tr>";
25 | }
26 | print "
";
27 | $qh->finish(); #To inform that operation is finished
28 | $dbh->disconnect(); #close the connection to the database print"";
29 |
--------------------------------------------------------------------------------
/Autonomous/Sem7/Web Lab/pg11/p11.php:
--------------------------------------------------------------------------------
1 |
3 | Hello! Last visted date: " . $cookieData . " ";
34 | ?>
35 |
--------------------------------------------------------------------------------
/Autonomous/Sem7/Web Lab/pg12/p12.php:
--------------------------------------------------------------------------------
1 | the counter is now $_SESSION[count]
";
26 | }
27 | echo "";
--------------------------------------------------------------------------------
/Autonomous/Sem7/Web Lab/pg14/commands.bash:
--------------------------------------------------------------------------------
1 | # Dont' run this file as a bash script. Use it for command reference
2 |
3 | /etc/init.d/mysqld start #if mysql isn't running
4 | mysql -u root #if theres no password required to login
5 | mysql -u root -p password #otherwise
6 |
7 | # If mysql isn't on the PATH i.e. on running mysql you get 'command not found' error, do the following
8 | cd /var/lib/mysql
--------------------------------------------------------------------------------
/Autonomous/Sem7/Web Lab/pg14/p14b.php:
--------------------------------------------------------------------------------
1 | ";
15 | echo "
Accession Number
Title
Author
Editor
Publisher
";
16 | $num = mysql_num_rows($result);
17 | for ($i = 0; $i < $num; $i++) {
18 |
19 | // Obtaining data field by field for each column using for loop
20 | $acs = mysql_result($result, $i, 'acs');
21 | $t = mysql_result($result, $i, 'title');
22 | $a = mysql_result($result, $i, 'author');
23 | $e = mysql_result($result, $i, 'edi');
24 | $p = mysql_result($result, $i, 'pub');
25 |
26 | // Displaying as a table row
27 | echo "
14 |
15 | USN:
16 |
17 |
18 | NAME:
19 |
20 |
21 | COLLEGE:
22 |
23 |
24 | BRANCH:
25 |
26 |
27 | YEAR OF JOINING:
28 |
29 |
30 | E-MAIL:
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Autonomous/Sem7/Web Lab/pg7/p07a.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 |
3 | ################################################################
4 | # Server configuration is always stored in the $ENV variable
5 | # In this program, we simpy access the required info from $ENV
6 | ################################################################
7 |
8 | use CGI ':standard';
9 | print "Content-type: text/html","\n\n";
10 | print "\n";
11 | print "About this Server\n";
12 | print "
About this server
","\n";
13 | print"";
14 | print "Server name :",$ENV{'SERVER_NAME'}," ";
15 | print "Running on port :",$ENV{'SERVER_PORT'}," ";
16 | print "Server software :",$ENV{'SERVER_SOFTWARE'}," ";
17 | print "CGI-Revision :",$ENV{'GATEWAY_INTERFACE'}," ";
18 | print "\n";
19 | print "\n";
20 |
--------------------------------------------------------------------------------
/Autonomous/Sem7/Web Lab/pg7/p07b.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/Autonomous/Sem7/Web Lab/pg7/p07b.pl:
--------------------------------------------------------------------------------
1 | #! /usr/bin/perl
2 |
3 | use CGI ':standard';
4 | print "Content-type: text/html \n\n";
5 | $c = param('com');
6 | system($c);
7 |
--------------------------------------------------------------------------------
/Autonomous/Sem7/Web Lab/pg8/count.txt:
--------------------------------------------------------------------------------
1 | 10
--------------------------------------------------------------------------------
/Autonomous/Sem7/Web Lab/pg8/p08a.pl:
--------------------------------------------------------------------------------
1 | #! /usr/bin/perl
2 |
3 | use CGI ':standard';
4 | use CGI::Carp qw(warningsToBrowser);
5 |
6 |
7 | ######################################################################
8 | # This program requires count.txt to be created before it.
9 | # So create count.txt using gedit or any text editor and initialise
10 | # it with zero
11 | # After that give write permissions to all users. Else only the program
12 | # itself will be able write into the file, not the browser
13 | #
14 | # Command:
15 | # chmod a+w count.txt
16 | ######################################################################
17 |
18 |
19 | print header();
20 |
21 | #Set the Title for the title bar and background color and text colour.
22 | print start_html(-title=>"webpage counter",-bgcolor=>"black",-text=>"red");
23 |
24 | #Open count.txt used to store the view count
25 | open(FILE,';
29 |
30 | #close the file as no more reading is left
31 | close(FILE);
32 |
33 | #increment the count whenever the page(file)is opened and closed.
34 | $count++;
35 |
36 | #open the file for writing
37 | open(FILE,'>count.txt');
38 |
39 | #write $count into the file
40 | print FILE "$count";
41 |
42 | #close the file
43 | close(FILE);
44 |
45 | #Display $count on the browser
46 | print b("this page has been viewed $count times");
47 |
48 | #Close html
49 | print end_html();
--------------------------------------------------------------------------------
/Autonomous/Sem7/Web Lab/pg9/p09.pl:
--------------------------------------------------------------------------------
1 | #! /usr/bin/perl
2 | use CGI ':standard';
3 |
4 | print "Content-Type: text/html\n\n";
5 | print start_html(-title => "Program 9", -bgcolor => "Black", -text => "White"); #sets the title and background color
6 | ($s,$m,$h) = localtime(); #to get the current time
7 | print br,br,"The current system time is $h:$m:$s"; #equivalent to
of xhtml and print the time.
8 | print br,br,hr,"In words $h hours $m minutes $s seconds";
9 | print end_html(); #ends the HTML document by printing the and tags.
--------------------------------------------------------------------------------
/Autonomous/Sem8/Readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/Autonomous/Sem8/Readme.txt
--------------------------------------------------------------------------------
/Autonomous/Sem8/Syllabus.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/Autonomous/Sem8/Syllabus.md
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/14cpl16.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem1_Sem2/CPL2014/14cpl16.pdf
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/CPL0.5.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem1_Sem2/CPL2014/CPL0.5.pdf
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Latex/cc-by-sa.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem1_Sem2/CPL2014/Latex/cc-by-sa.png
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Latex/fsmk_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem1_Sem2/CPL2014/Latex/fsmk_logo.png
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Latex/gnu-gcc-cb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem1_Sem2/CPL2014/Latex/gnu-gcc-cb.png
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Latex/i-gnu-c3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem1_Sem2/CPL2014/Latex/i-gnu-c3.png
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/ Updated Lab Set/03aSquareRoot.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | int main()
6 | {
7 | float fVal, fNextGuess, fLastGuess = 1.0f, fDiff ;
8 | printf("\nEnter a value whose square root has to be calculated\n");
9 | scanf("%f", &fVal);
10 | do
11 | {
12 | fNextGuess = 0.5 * (fLastGuess + (fVal/fLastGuess));
13 | fDiff = fabs(fNextGuess - fLastGuess);
14 | fLastGuess = fNextGuess;
15 | }while (fDiff > 0.0001);
16 |
17 | printf("\nSquare root of %g = %g\n", fVal, fNextGuess);
18 | return 0;
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/ Updated Lab Set/03bCheckLeapYear.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main()
5 | {
6 | int iYear;
7 |
8 | printf("\n Enter a year\n");
9 | scanf("%d", &iYear);
10 |
11 | if(iYear % 4 == 0 && iYear % 100 != 0)
12 | printf("\n%d is a leap year\n",iYear);
13 | else if(iYear % 400 == 0)
14 | printf("\n%d is a leap year\n",iYear);
15 | else
16 | printf("\n%d is not a leap year\n",iYear);
17 | return 0;
18 | }
19 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/ Updated Lab Set/04Horner.c:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | *File : 04Horner.c
3 | *Description : Program to implement Horners method for Polynomial evaluation
4 | *Author : Prabodh C P
5 | *Compiler : gcc compiler, Ubuntu 8.10
6 | *Date : 7 September 2010
7 | ***************************************************************************/
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | /***************************************************************************
14 | *Function : main
15 | *Input parameters: none
16 | *RETURNS : 0 on success
17 | ***************************************************************************/
18 |
19 | int main(void)
20 | {
21 |
22 | int iDeg,i,iaCoeff[10];
23 | float fX,fSum=0;
24 |
25 | printf("\n*********************************************************************");
26 | printf("\n*\tPROGRAM TO EVALUATE A POLYNOMIAL USING HORNERS METHOD\t *\n");
27 | printf("*********************************************************************");
28 |
29 | printf("\nEnter the degree of the polynomial and value of x\n");
30 | scanf("%d%f",&iDeg,&fX);
31 |
32 | printf("\nEnter the coefficients \n");
33 | for(i=0;i<=iDeg;i++)
34 | {
35 | scanf("%d",&iaCoeff[i]);
36 | }
37 |
38 | for(i=0;i
2 | #include
3 |
4 | #define PI 3.1416
5 |
6 | int main()
7 | {
8 | float fAngD, fAngR;
9 | float fTerm, fNum, fDen, fVal;
10 | int i,iNum;
11 |
12 | printf("Enter the Angle ....\n");
13 | scanf("%f",&fAngD);
14 |
15 | printf("Angle = %f\n",fAngD);
16 |
17 | printf("Enter the Number of terms...\n");
18 | scanf("%d",&iNum);
19 | printf("No of terms = %d\n",iNum);
20 |
21 | fAngR= (fAngD*PI)/180 ;
22 |
23 | fNum=fAngR;
24 | fDen=1.0;
25 | fVal =0.0;
26 | fTerm=fNum/fDen;
27 | for(i=1;i<=iNum;i++)
28 | {
29 | fVal = fVal + fTerm;
30 | fNum = -fNum * fAngR * fAngR ;
31 | fDen = fDen * (2*i) * (2*i+1);
32 | fTerm = fNum/fDen;
33 | }
34 | printf(" Calculated value is :Sin( %f ) = %f\n",fAngD,fVal);
35 | printf("Built In function value is :Sin( %f ) = %f\n",
36 | fAngD, sin(fAngR));
37 | return 0;
38 | }
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/ Updated Lab Set/10BisPrimefn.c:
--------------------------------------------------------------------------------
1 | /*pg 28 and 293 in second 183*/
2 | #include
3 | #include
4 |
5 | int fnCheckPrime(int);
6 |
7 | int main(void)
8 | {
9 | int iVal1, iVal2, i;
10 |
11 | printf("\nEnter the range\n");
12 | scanf("%d%d",&iVal1, &iVal2);
13 |
14 | printf("\nPrime numbers in the range %d to %d is\n", iVal1, iVal2);
15 | for(i=iVal1;i<=iVal2;i++)
16 | {
17 | if(fnCheckPrime(i)) //arguments
18 | printf("%d\t", i);
19 | }
20 |
21 | return 0;
22 | }
23 |
24 | /*Function with return values and parameters*/
25 |
26 | int fnCheckPrime(int iX) //parameters
27 | {
28 | int i,isPrime = 1;
29 | for(i=2;i
2 | #include
3 |
4 | int fnFactorial(int);
5 |
6 | int main()
7 | {
8 | int iN,iR,iNCR;
9 | printf("\nEnter the value of n\n");
10 | scanf("%d", &iN);
11 | printf("\nEnter the value of r\n");
12 | scanf("%d", &iR);
13 |
14 | if(iN < iR)
15 | {
16 | printf("\nnCr does not exist\n");
17 | exit(0);
18 | }
19 |
20 | iNCR = (fnFactorial(iN)/(fnFactorial(iR)*fnFactorial(iN-iR)));
21 |
22 | printf("\nFor n = %d and r = %d, %dC%d = %d\n", iN ,iR, iN, iR, iNCR);
23 | return 0;
24 | }
25 |
26 | int fnFactorial(int iVal)
27 | {
28 | if(0 == iVal)
29 | return 1;
30 | else
31 | return (iVal * fnFactorial(iVal - 1));
32 | }
33 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/ Updated Lab Set/12File.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main()
5 | {
6 | FILE *fp1, *fp2, *fp3;
7 | char studName[30], studUsn[10];
8 |
9 |
10 | fp1 = fopen("studentname.txt", "r");
11 | fp2 = fopen("usn.txt", "r");
12 | fp3 = fopen("output.txt", "w");
13 |
14 | fprintf(fp3,"%20s\t%20s\n","StudentName","USN");
15 | // while(fgets(studName, 30, fp1)!=EOF && fscanf(fp2,"%s",studUsn)!=EOF)
16 | while(fscanf(fp1,"%s",studName)!=EOF && fscanf(fp2,"%s",studUsn)!=EOF)
17 | {
18 | fprintf(fp3,"%20s\t%20s\n",studName,studUsn);
19 | }
20 | fclose(fp3);
21 | fp3 = fopen("output.txt", "r");
22 |
23 | while(fscanf(fp3,"%s%s",studName,studUsn)!=EOF)
24 | {
25 | printf("%20s\t%20s\n",studName,studUsn);
26 | }
27 |
28 | fclose(fp1);
29 | fclose(fp2);
30 | fclose(fp3);
31 | return 0;
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/ Updated Lab Set/13StudMarks.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | typedef struct
5 | {
6 | int iRollNo;
7 | char acName[30];
8 | int iMarks;
9 | char cGrade;
10 | }STUDENT;
11 |
12 | int main()
13 | {
14 | STUDENT s[20];
15 | int i, iNum, iFound = 0;
16 | char acStudName[30];
17 |
18 | printf("\nEnter the number of students\n");
19 | scanf("%d", &iNum);
20 | getchar();
21 |
22 | printf("\nEnter Student Details\n");
23 | for(i=0;i
2 | #include
3 | #include
4 |
5 | int main()
6 | {
7 | int iNum, i, j;
8 | double daArr[50], dTemp;
9 | double *dPtr;
10 |
11 | double dSum,dMean,dVar,dStdDev;
12 |
13 | dPtr = daArr;
14 |
15 | printf("\nEnter the no of elements in the array\n");
16 | scanf("%d",&iNum);
17 |
18 | printf("\nEnter elements of Array\n");
19 | for(i = 0; i < iNum; i++)
20 | scanf("%lf",dPtr+i);
21 |
22 | printf("\nThe elements of Array\n");
23 | for(i = 0; i < iNum; i++)
24 | printf("%0.2lf \t",*(dPtr+i));
25 | printf("\n\n");
26 |
27 | for(i = 0; i < iNum; i++)
28 | dSum += *(dPtr+i);
29 |
30 | dMean = dSum/iNum;
31 |
32 |
33 | for(i = 0; i < iNum; i++)
34 | {
35 | dVar += ((*(dPtr+i)-dMean)*(*(dPtr+i)-dMean));
36 | }
37 | dVar = dVar/iNum;
38 |
39 | dStdDev = sqrt(dVar);
40 |
41 | printf("\nMean = %g\n", dMean);
42 | printf("\nVariance = %g\n", dVar);
43 | printf("\nStd Deviation = %g\n", dStdDev);
44 |
45 | return 0;
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/ Updated Lab Set/studentname.txt:
--------------------------------------------------------------------------------
1 | Raju
2 | Rani
3 | Sid
4 | Ali
5 | Mary
6 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/ Updated Lab Set/usn.txt:
--------------------------------------------------------------------------------
1 | 1CR14CS037
2 | 1KT13CS067
3 | 1PE14IS098
4 | 4NI14CS068
5 | 1SI14CS112
6 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/Older Programs/12FileAppend.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main()
5 | {
6 | FILE *fp1,*fp2, *fp3;
7 | int iWordCount = 0, iLineCount = 0;
8 | char cCharacter;
9 |
10 | fp1 = fopen("Ramayana.in","r");
11 | fp2 = fopen("Mahabharatha.in", "r");
12 | fp3 = fopen("Karnataka.in", "w+");
13 |
14 | while((cCharacter=fgetc(fp1))!=EOF)
15 | {
16 | fputc(cCharacter,fp3);
17 | }
18 |
19 | while((cCharacter=fgetc(fp2))!=EOF)
20 | {
21 | fputc(cCharacter,fp3);
22 | }
23 |
24 | rewind(fp3);
25 |
26 | while((cCharacter=fgetc(fp3))!=EOF)
27 | {
28 | if(cCharacter == '\n')
29 | {
30 | iLineCount++;
31 | iWordCount++;
32 | }
33 | else if(cCharacter == '\t' || cCharacter == ' ')
34 | iWordCount++;
35 | printf("%c",cCharacter);
36 | }
37 | fclose(fp1);
38 | fclose(fp2);
39 | fclose(fp3);
40 |
41 | printf("\n\nNumber of lines is : %d\n", iLineCount);
42 |
43 | printf("\n\nNumber of words is : %d\n", iWordCount);
44 |
45 | //Code for Verification (works only on GNU\Linux)
46 | printf("\nOutput of command : wc Karnataka.in -lw\n");
47 | system("wc Karnataka.in -lw");
48 | return 0;
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/Older Programs/14MeanStd.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | int main()
6 | {
7 | int iNum, i, j;
8 | double daArr[50], dTemp;
9 | double *dPtr;
10 |
11 | double dSum,dMean,dVar,dStdDev;
12 |
13 | dPtr = daArr;
14 |
15 | printf("\nEnter the no of elements in the array\n");
16 | scanf("%d",&iNum);
17 |
18 | printf("\nEnter elements of Array\n");
19 | for(i = 0; i < iNum; i++)
20 | scanf("%lf",dPtr+i);
21 |
22 | printf("\nThe elements of Array\n");
23 | for(i = 0; i < iNum; i++)
24 | printf("%0.2lf \t",*(dPtr+i));
25 | printf("\n\n");
26 |
27 | for(i = 0; i < iNum; i++)
28 | dSum += *(dPtr+i);
29 |
30 | dMean = dSum/iNum;
31 |
32 |
33 | for(i = 0; i < iNum; i++)
34 | {
35 | dVar += ((*(dPtr+i)-dMean)*(*(dPtr+i)-dMean));
36 | }
37 | dVar = dVar/iNum;
38 |
39 | dStdDev = sqrt(dVar);
40 |
41 | printf("\nMean = %g\n", dMean);
42 | printf("\nVariance = %g\n", dVar);
43 | printf("\nStd Deviation = %g\n", dStdDev);
44 |
45 | return 0;
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/Older Programs/14aPointerArrSum.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main(void)
4 | {
5 | int iaArr[100],iNum,i,iTotal;
6 | int *iPtr;
7 |
8 | iPtr = iaArr;
9 | printf("\nEnter the number of elements\n");
10 | scanf("%d",&iNum);
11 |
12 | printf("\nEnter the elements\n");
13 | for(i=0;i
2 | #include
3 |
4 | int main()
5 | {
6 | int *iPtr, iNum, i, iSum=0;
7 |
8 | printf("\nEnter number of elements : ");
9 | scanf("%d", &iNum);
10 |
11 | iPtr = (int*)malloc(iNum * sizeof(int));
12 |
13 | for(i=0;i
2 | #include
3 |
4 | int main()
5 | {
6 | int iNum, i, j;
7 | float faArr1[50], fTemp;
8 | float *fPtr;
9 |
10 | float fMedian;
11 |
12 | fPtr = faArr1;
13 |
14 | printf("\nEnter the no of elements in the array\n");
15 | scanf("%d",&iNum);
16 |
17 | printf("\nEnter elements of Array\n");
18 | for(i = 0; i < iNum; i++)
19 | scanf("%f",fPtr+i);
20 |
21 | printf("\nThe elements of Array\n");
22 | for(i = 0; i < iNum; i++)
23 | printf("%0.2f \t",*(fPtr+i));
24 |
25 | for(i = 0; i < iNum-1; i++)
26 | {
27 | for(j = i+1; j < iNum; j++)
28 | {
29 | if(faArr1[i] > faArr1[j])
30 | {
31 | fTemp = faArr1[i];
32 | faArr1[i] = faArr1[j];
33 | faArr1[j] = fTemp;
34 | }
35 | }
36 |
37 | }
38 |
39 | if(iNum%2)
40 | fMedian = *(fPtr+(iNum/2));
41 | else
42 | fMedian = (*(fPtr+(iNum/2)) + *(fPtr+(iNum/2)-1))/2.0f;
43 |
44 |
45 | printf("\nMedian = %g\n", fMedian);
46 |
47 | return 0;
48 | }
49 |
50 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/Revised Lab Set/03aSquareRoot.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | int main()
6 | {
7 | float fVal, fNextGuess, fLastGuess = 1.0f, fDiff ;
8 | printf("\nEnter a value whose square root has to be calculated\n");
9 | scanf("%f", &fVal);
10 | do
11 | {
12 | fNextGuess = 0.5 * (fLastGuess + (fVal/fLastGuess));
13 | fDiff = fabs(fNextGuess - fLastGuess);
14 | fLastGuess = fNextGuess;
15 | }while (fDiff > 0.0001);
16 |
17 | printf("\nSquare root of %g = %g\n", fVal, fNextGuess);
18 | return 0;
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/Revised Lab Set/03bCheckLeapYear.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main()
5 | {
6 | int iYear;
7 |
8 | printf("\n Enter a year\n");
9 | scanf("%d", &iYear);
10 |
11 | if(iYear % 4 == 0 && iYear % 100 != 0)
12 | printf("\n%d is a leap year\n",iYear);
13 | else if(iYear % 400 == 0)
14 | printf("\n%d is a leap year\n",iYear);
15 | else
16 | printf("\n%d is not a leap year\n",iYear);
17 | return 0;
18 | }
19 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/Revised Lab Set/04Horner.c:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | *File : 04Horner.c
3 | *Description : Program to implement Horners method for Polynomial evaluation
4 | *Author : Prabodh C P
5 | *Compiler : gcc compiler, Ubuntu 8.10
6 | *Date : 7 September 2010
7 | ***************************************************************************/
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | /***************************************************************************
14 | *Function : main
15 | *Input parameters: none
16 | *RETURNS : 0 on success
17 | ***************************************************************************/
18 |
19 | int main(void)
20 | {
21 |
22 | int iDeg,i,iaCoeff[10];
23 | float fX,fSum=0;
24 |
25 | printf("\n*********************************************************************");
26 | printf("\n*\tPROGRAM TO EVALUATE A POLYNOMIAL USING HORNERS METHOD\t *\n");
27 | printf("*********************************************************************");
28 |
29 | printf("\nEnter the degree of the polynomial and value of x\n");
30 | scanf("%d%f",&iDeg,&fX);
31 |
32 | printf("\nEnter the coefficients \n");
33 | for(i=0;i<=iDeg;i++)
34 | {
35 | scanf("%d",&iaCoeff[i]);
36 | }
37 |
38 | for(i=0;i
2 | #include
3 |
4 | #define PI 3.1416
5 |
6 | int main()
7 | {
8 | float fAngD, fAngR;
9 | float fTerm, fNum, fDen, fVal;
10 | int i,iNum;
11 |
12 | printf("Enter the Angle ....\n");
13 | scanf("%f",&fAngD);
14 |
15 | printf("Angle = %f\n",fAngD);
16 |
17 | printf("Enter the Number of terms...\n");
18 | scanf("%d",&iNum);
19 | printf("No of terms = %d\n",iNum);
20 |
21 | fAngR= (fAngD*PI)/180 ;
22 |
23 | fNum=fAngR;
24 | fDen=1.0;
25 | fVal =0.0;
26 | fTerm=fNum/fDen;
27 | for(i=1;i<=iNum;i++)
28 | {
29 | fVal = fVal + fTerm;
30 | fNum = -fNum * fAngR * fAngR ;
31 | fDen = fDen * (2*i) * (2*i+1);
32 | fTerm = fNum/fDen;
33 | }
34 | printf(" Calculated value is :Sin( %f ) = %f\n",fAngD,fVal);
35 | printf("Built In function value is :Sin( %f ) = %f\n",
36 | fAngD, sin(fAngR));
37 | return 0;
38 | }
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/Revised Lab Set/10BisPrimefn.c:
--------------------------------------------------------------------------------
1 | /*pg 28 and 293 in second 183*/
2 | #include
3 | #include
4 |
5 | int fnCheckPrime(int);
6 |
7 | int main(void)
8 | {
9 | int iVal1, iVal2, i;
10 |
11 | printf("\nEnter the range\n");
12 | scanf("%d%d",&iVal1, &iVal2);
13 |
14 | printf("\nPrime numbers in the range %d to %d is\n", iVal1, iVal2);
15 | for(i=iVal1;i<=iVal2;i++)
16 | {
17 | if(fnCheckPrime(i)) //arguments
18 | printf("%d\t", i);
19 | }
20 |
21 | return 0;
22 | }
23 |
24 | /*Function with return values and parameters*/
25 |
26 | int fnCheckPrime(int iX) //parameters
27 | {
28 | int i,isPrime = 1;
29 | for(i=2;i
2 | #include
3 |
4 | int fnFactorial(int);
5 |
6 | int main()
7 | {
8 | int iN,iR,iNCR;
9 | printf("\nEnter the value of n\n");
10 | scanf("%d", &iN);
11 | printf("\nEnter the value of r\n");
12 | scanf("%d", &iR);
13 |
14 | if(iN < iR)
15 | {
16 | printf("\nnCr does not exist\n");
17 | exit(0);
18 | }
19 |
20 | iNCR = (fnFactorial(iN)/(fnFactorial(iR)*fnFactorial(iN-iR)));
21 |
22 | printf("\nFor n = %d and r = %d, %dC%d = %d\n", iN ,iR, iN, iR, iNCR);
23 | return 0;
24 | }
25 |
26 | int fnFactorial(int iVal)
27 | {
28 | if(0 == iVal)
29 | return 1;
30 | else
31 | return (iVal * fnFactorial(iVal - 1));
32 | }
33 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/Revised Lab Set/12File.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main()
5 | {
6 | FILE *fp1, *fp2, *fp3;
7 | char studName[30], studUsn[10];
8 |
9 |
10 | fp1 = fopen("studentname.txt", "r");
11 | fp2 = fopen("usn.txt", "r");
12 | fp3 = fopen("output.txt", "w");
13 |
14 | fprintf(fp3,"%20s\t%20s\n","StudentName","USN");
15 | // while(fgets(studName, 30, fp1)!=EOF && fscanf(fp2,"%s",studUsn)!=EOF)
16 | while(fscanf(fp1,"%s",studName)!=EOF && fscanf(fp2,"%s",studUsn)!=EOF)
17 | {
18 | fprintf(fp3,"%20s\t%20s\n",studName,studUsn);
19 | }
20 | fclose(fp3);
21 | fp3 = fopen("output.txt", "r");
22 |
23 | while(fscanf(fp3,"%s%s",studName,studUsn)!=EOF)
24 | {
25 | printf("%20s\t%20s\n",studName,studUsn);
26 | }
27 |
28 | fclose(fp1);
29 | fclose(fp2);
30 | fclose(fp3);
31 | return 0;
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/Revised Lab Set/13StudMarks.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | typedef struct
5 | {
6 | int iRollNo;
7 | char acName[30];
8 | int iMarks;
9 | char cGrade;
10 | }STUDENT;
11 |
12 | int main()
13 | {
14 | STUDENT s[20];
15 | int i, iNum, iFound = 0;
16 | char acStudName[30];
17 |
18 | printf("\nEnter the number of students\n");
19 | scanf("%d", &iNum);
20 | getchar();
21 |
22 | printf("\nEnter Student Details\n");
23 | for(i=0;i
2 | #include
3 | #include
4 |
5 | int main()
6 | {
7 | int iNum, i, j;
8 | double daArr[50], dTemp;
9 | double *dPtr;
10 |
11 | double dSum,dMean,dVar,dStdDev;
12 |
13 | dPtr = daArr;
14 |
15 | printf("\nEnter the no of elements in the array\n");
16 | scanf("%d",&iNum);
17 |
18 | printf("\nEnter elements of Array\n");
19 | for(i = 0; i < iNum; i++)
20 | scanf("%lf",dPtr+i);
21 |
22 | printf("\nThe elements of Array\n");
23 | for(i = 0; i < iNum; i++)
24 | printf("%0.2lf \t",*(dPtr+i));
25 | printf("\n\n");
26 |
27 | for(i = 0; i < iNum; i++)
28 | dSum += *(dPtr+i);
29 |
30 | dMean = dSum/iNum;
31 |
32 |
33 | for(i = 0; i < iNum; i++)
34 | {
35 | dVar += ((*(dPtr+i)-dMean)*(*(dPtr+i)-dMean));
36 | }
37 | dVar = dVar/iNum;
38 |
39 | dStdDev = sqrt(dVar);
40 |
41 | printf("\nMean = %g\n", dMean);
42 | printf("\nVariance = %g\n", dVar);
43 | printf("\nStd Deviation = %g\n", dStdDev);
44 |
45 | return 0;
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/Revised Lab Set/studentname.txt:
--------------------------------------------------------------------------------
1 | Raju
2 | Rani
3 | Sid
4 | Ali
5 | Mary
6 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/Programs/Revised Lab Set/usn.txt:
--------------------------------------------------------------------------------
1 | 1CR14CS037
2 | 1KT13CS067
3 | 1PE14IS098
4 | 4NI14CS068
5 | 1SI14CS112
6 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/CPL2014/SyllabusCPL.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem1_Sem2/CPL2014/SyllabusCPL.pdf
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/OLD2010/CPP_Lab/.old/03Palindrome.c:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | *File : 03Palindrome.c
3 | *Description : Program to check whether the given integer is a Palindrome or not
4 | *Author : Prabodh C P
5 | *Compiler : gcc compiler, Ubuntu 10.04
6 | *Date : 4 July 2012
7 | ***************************************************************************/
8 |
9 | #include
10 | #include
11 |
12 | /***************************************************************************
13 | *Function : main
14 | *Input parameters: no parameters
15 | *RETURNS : 0 on success
16 | ***************************************************************************/
17 |
18 | int main(void)
19 | {
20 | int iNum,iRev = 0,iTemp,iRem;
21 |
22 | printf("\n**************************************************************************");
23 | printf("\n*\tPROGRAM TO CHECK WHETHER AN INTEGER IS A PALINDROME OR NOT\t *\n");
24 | printf("**************************************************************************");
25 |
26 | printf("\nEnter a number\n");
27 | scanf("%d",&iNum);
28 |
29 | iTemp = iNum;
30 |
31 | while(iNum!=0)
32 | {
33 | iRem = iNum % 10;
34 | iRev = iRev * 10 + iRem;
35 | iNum = iNum/10;
36 | }
37 | printf("\nReverse is %d",iRev);
38 |
39 | if(iRev == iTemp)
40 | printf("\nNumber %d is a palindrome\n",iTemp);
41 | else
42 | printf("\nNumber %d is not a palindrome\n",iTemp);
43 |
44 | return 0;
45 | }
46 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/OLD2010/CPP_Lab/.old/04Horner.c:
--------------------------------------------------------------------------------
1 | /***************************************************************************
2 | *File : 04Horner.c
3 | *Description : Program to implement Horners method for Polynomial evaluation
4 | *Author : Prabodh C P
5 | *Compiler : gcc compiler, Ubuntu 8.10
6 | *Date : 7 September 2010
7 | ***************************************************************************/
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | /***************************************************************************
14 | *Function : main
15 | *Input parameters: no parameters
16 | *RETURNS : 0 on success
17 | ***************************************************************************/
18 |
19 | int main(void)
20 | {
21 |
22 | int iDeg,i,iaArr[10];
23 | float fX,fSum=0;
24 |
25 | printf("\n*********************************************************************");
26 | printf("\n*\tPROGRAM TO EVALUATE A POLYNOMIAL USING HORNERS METHOD\t *\n");
27 | printf("*********************************************************************");
28 |
29 | printf("\nEnter the degree of the polynomial and value of x\n");
30 | scanf("%d%f",&iDeg,&fX);
31 |
32 | printf("\nEnter the coefficients in descending order of degree\n");
33 | for(i=0;i<=iDeg;i++)
34 | {
35 | scanf("%d",&iaArr[i]);
36 | }
37 |
38 | for(i=0;i
10 | #include
11 |
12 | /***************************************************************************
13 | *Function : main
14 | *Input parameters: no parameters
15 | *RETURNS : 0 on success
16 | ***************************************************************************/
17 |
18 | int main(void)
19 | {
20 |
21 | int iLen=0;
22 | //unsigned int i=1;
23 | unsigned int i=~0;
24 |
25 | //printf("\n%d\n",sizeof(int));
26 | //printf("\n%lu\n",i);
27 | printf("\n*************************************************");
28 | printf("\n*\tPROGRAM TO CALCULATE WORD LENGTH\t*\n");
29 | printf("*************************************************");
30 |
31 | for(i = 1; i != 0; i = i << 1)
32 | {
33 | //printf("\n%u",i);
34 | iLen++;
35 | }
36 | //printf("\n%u\n",i);
37 | printf("\n\nThe Word length of the host machine is %d\n\n", iLen);
38 |
39 | return 0;
40 | }
41 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/OLD2010/CPP_Lab/.old/14prime.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | int main(void)
5 | {
6 | int a[200];
7 | int n,i,k;
8 |
9 |
10 | printf("enter the value of n");
11 | scanf("%d",&n);
12 | for(i=2;i<=n;i++)
13 | {
14 | a[i]=i;
15 | }
16 |
17 | omp_set_num_threads(5);
18 | for(k=2;k<=sqrt(n);k++)
19 | {
20 | if(a[k]!=0)
21 | {
22 | #pragma omp parallel for private(i)
23 | for(i=k*k;i<=n;i=i+k)
24 | {
25 | printf("\nThread id=%d makes %03d position zero",omp_get_thread_num(),i);
26 | a[i]=0;
27 | }
28 | }
29 | }
30 |
31 |
32 | printf("\nPrime numbers are \n");
33 |
34 | for(i=2;i<=n;i++)
35 | {
36 | if(a[i]>0)printf("%d\t",a[i]);
37 | }
38 | printf("\n");
39 | return 0;
40 |
41 | }//end of main
42 |
43 |
44 | /*
45 | to compile
46 | cc prime.c -fopenmp -lm
47 |
48 | to run
49 | ./a.out
50 |
51 | */
52 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/OLD2010/CPP_Lab/CPL.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem1_Sem2/OLD2010/CPP_Lab/CPL.pdf
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/OLD2010/CPP_Lab/output/audit.txt:
--------------------------------------------------------------------------------
1 | Foremost version 1.5.7 by Jesse Kornblum, Kris Kendall, and Nick Mikus
2 | Audit File
3 |
4 | Foremost started at Thu Mar 13 22:56:08 2014
5 | Invocation: foremost image.dd
6 | Output directory: /home/branch/workspace/Lab Manual 1/CS-VTU-Lab-Manual/VTU/Sem1_Sem2/CPP_Lab/output
7 | Configuration file: /etc/foremost.conf
8 | ------------------------------------------------------------------
9 | File: stdin
10 | Start: Thu Mar 13 22:56:08 2014
11 | Length: Unknown
12 |
13 | Num Name (bs=512) Size File Offset Comment
14 |
15 | Interrupt received at Thu Mar 13 23:06:21 2014
16 |
--------------------------------------------------------------------------------
/VTU/Sem1_Sem2/Readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem1_Sem2/Readme.txt
--------------------------------------------------------------------------------
/VTU/Sem3/DS_Lab/.old/10_heap.c:
--------------------------------------------------------------------------------
1 | /*Design, develop, and execute a program in C to create a max heap of integers by
2 | accepting one element at a time and by inserting it immediately in to the heap. Use the
3 | array representation for the heap. Display the array at the end of insertion phase.*/
4 |
5 | #include
6 | #define MAX_ELEMENTS 200
7 | #define HEAP_FULL(n)(n==MAX_ELEMENTS-1)
8 | typedef struct{
9 | int key;
10 | }element;
11 | element heap[MAX_ELEMENTS];
12 | void push(int, int *);
13 | int k=0;
14 | int main()
15 | {
16 | int n,i=1,j;
17 | if(HEAP_FULL(k))
18 | printf("The heap is full.\n");
19 | while(i==1)
20 | {
21 | printf("Enter the element to be inserted into the heap.\n");
22 | scanf("%d",&n);
23 | push(n,&k);
24 | printf("Enter 1 to continue insertion or any other number to display the heap.\n");
25 | scanf("%d",&i);
26 | }
27 | printf("The elements of the heap are \n");
28 | for(j=1;j<=k;j++)
29 | printf("%d\t",heap[j].key);
30 | printf("\n");
31 | return 0;
32 | }
33 | void push(int n, int *k)
34 | {
35 | int i;
36 | i = ++(*k);
37 | while((i!=1)&&(n>heap[i/2].key))
38 | {
39 | heap[i]=heap[i/2];
40 | i/=2;
41 | }
42 | heap[i].key=n;
43 | }
44 |
--------------------------------------------------------------------------------
/VTU/Sem3/DS_Lab/.old/6_String.cpp:
--------------------------------------------------------------------------------
1 | /*Design, develop, and execute a program in C++ to create a class called STRING and implement the
2 | following operations. Display the results after every operation by overloading the operator <<
3 | i) STRING s1 = “VTU”
4 | ii) STRING s2 = “BELGAUM”
5 | iii) STIRNG s3 = s1 + s2; (Use copy constructor)
6 | */
7 | #include
8 | #include
9 | using namespace std;
10 | class STRING
11 | {
12 | char str[100];
13 | public:
14 | STRING()
15 | {
16 | strcpy(str," ");
17 | }
18 | STRING(char *s1)
19 | {
20 | strcpy(str,s1);
21 | }
22 | STRING(STRING& s)
23 | {
24 | strcpy(str,s.str);
25 | }
26 | STRING operator +(STRING );
27 | friend ostream& operator <<(ostream& c,STRING s1)
28 | {
29 | c<
2 | #include
3 | using namespace std;
4 |
5 | const int MAX = 100;
6 |
7 |
8 | void DepthFirstSearch(int currentVertex, int v[MAX], int g[MAX][MAX], int n)
9 | {
10 |
11 | int i;
12 |
13 | v[currentVertex] = 1;
14 |
15 | for (i=0; i> numVert;
29 |
30 | for (i=0; i> graph[i][j];
38 |
39 | for (i=0; i 4
8 | ) OR cname IN(
9 | SELECT cname
10 | FROM CLASS
11 | WHERE room = '502'
12 | );
13 |
14 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question1/1_query3.sql:
--------------------------------------------------------------------------------
1 | SELECT DISTINCT s.sname
2 | FROM STUDENT s
3 | WHERE s.snum IN(
4 | SELECT e1.snum
5 | FROM ENROLLED e1, ENROLLED e2, CLASS c1, CLASS c2
6 | WHERE e1.snum = e2.snum AND e1.cname <> e2.cname AND e1.cname = c1.cname AND e2.cname = c2.cname AND c1.meets_at = c2.meets_at
7 | );
8 |
9 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question1/1_query4.sql:
--------------------------------------------------------------------------------
1 | SELECT DISTINCT f.fname
2 | FROM FACULTY f
3 | WHERE NOT EXISTS (
4 | SELECT c.room
5 | FROM CLASS c
6 | WHERE c.room NOT IN (
7 | SELECT c1.room
8 | FROM CLASS c1
9 | WHERE c1.fid = f.fid
10 | )
11 | );
12 |
13 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question1/1_query5.sql:
--------------------------------------------------------------------------------
1 | SELECT DISTINCT f.fname
2 | FROM FACULTY f
3 | WHERE f.fid IN (
4 | SELECT c.fid
5 | FROM CLASS c, ENROLLED e
6 | WHERE c.cname = e.cname GROUP BY c.cname
7 | HAVING COUNT(c.cname) < 5
8 | );
9 |
10 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question2/2i_create.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE AIRLINES;
2 | USE AIRLINES;
3 |
4 | CREATE TABLE IF NOT EXISTS FLIGHTS
5 | ( fno INTEGER,
6 | src VARCHAR(20),
7 | dest VARCHAR(20),
8 | distance INTEGER,
9 | departs TIME,
10 | arrives TIME,
11 | price DOUBLE,
12 | PRIMARY KEY(fno)
13 | );
14 |
15 | CREATE TABLE IF NOT EXISTS AIRCRAFT
16 | ( aid INTEGER,
17 | aname VARCHAR(20),
18 | cruisingrange INTEGER,
19 | fno INTEGER,
20 | PRIMARY KEY(aid),
21 | FOREIGN KEY(fno) REFERENCES FLIGHTS(fno)
22 | );
23 |
24 | CREATE TABLE IF NOT EXISTS EMPLOYEE
25 | ( eid INTEGER,
26 | ename VARCHAR(20),
27 | salary INTEGER,
28 | PRIMARY KEY(eid)
29 | );
30 |
31 | CREATE TABLE IF NOT EXISTS CERTIFIED
32 | ( eid INTEGER,
33 | aid INTEGER,
34 | PRIMARY KEY(eid,aid),
35 | FOREIGN KEY(eid) REFERENCES EMPLOYEE(eid),
36 | FOREIGN KEY(aid) REFERENCES AIRCRAFT(aid)
37 | );
38 |
39 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question2/2i_query1.sql:
--------------------------------------------------------------------------------
1 |
2 | SELECT DISTINCT a.aname
3 | FROM AIRCRAFT a
4 | WHERE a.aid IN (
5 | SELECT DISTINCT c.aid
6 | FROM CERTIFIED c
7 | WHERE eid IN (
8 | SELECT DISTINCT eid
9 | FROM EMPLOYEE
10 | WHERE salary > 80000
11 | )
12 | );
13 |
14 |
15 | SELECT DISTINCT a.aname
16 | FROM AIRCRAFT a
17 | WHERE a.aid IN (
18 | SELECT c.aid
19 | FROM CERTIFIED c, EMPLOYEE e
20 | WHERE c.eid = e.eid AND NOT EXISTS(
21 | SELECT *
22 | FROM EMPLOYEE e1
23 | WHERE e1.eid = e.eid AND salary < 80000
24 | )
25 | );
26 |
27 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question2/2i_query2.sql:
--------------------------------------------------------------------------------
1 | SELECT c.eid, MAX(cruisingrange)
2 | FROM CERTIFIED c, AIRCRAFT a
3 | WHERE c.aid = a.aid GROUP BY c.eid HAVING count(*)>3;
4 |
5 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question2/2i_query3.sql:
--------------------------------------------------------------------------------
1 | SELECT DISTINCT e.ename
2 | FROM EMPLOYEE e
3 | WHERE e.salary < (
4 | SELECT MIN(f.price)
5 | FROM FLIGHTS f
6 | WHERE f.src = "BLR" AND f.dest ="DEL"
7 | );
8 |
9 | UPDATE EMPLOYEE SET salary = (salary / 1000)
10 | WHERE eid IN(1,3,6,9,15);
11 |
12 |
13 | SELECT DISTINCT e.ename
14 | FROM EMPLOYEE e
15 | WHERE e.salary < (
16 | SELECT MIN(f.price)
17 | FROM FLIGHTS f
18 | WHERE f.src = "BLR" AND f.dest ="DEL"
19 | );
20 |
21 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question2/2i_query4.sql:
--------------------------------------------------------------------------------
1 | SELECT a.aname, AVG(e.salary)
2 | FROM AIRCRAFT a, EMPLOYEE e, CERTIFIED c
3 | WHERE e.eid = c.eid AND a.aid = c.aid AND a.cruisingrange > 1000
4 | GROUP BY a.aname;
5 |
6 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question2/2i_query5.sql:
--------------------------------------------------------------------------------
1 | SELECT DISTINCT e.ename
2 | FROM EMPLOYEE e, CERTIFIED c, AIRCRAFT a
3 | WHERE e.eid = c.eid AND c.aid = a.aid AND a.aname like "boeing%"
4 |
5 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question2/2i_query6.sql:
--------------------------------------------------------------------------------
1 | SELECT a.aid, f.fno, a.aname
2 | FROM AIRCRAFT a, FLIGHTS f
3 | WHERE f.src = "BLR" AND f.dest ="DEL" AND f.fno = a.fno;
4 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question3/3i_create.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE COURSEADOPTION;
2 | USE COURSEADOPTION;
3 |
4 | CREATE TABLE IF NOT EXISTS STUDENT
5 | ( regno VARCHAR(9),
6 | sname VARCHAR(15),
7 | major VARCHAR(20),
8 | bdate DATE,
9 | PRIMARY KEY(regno)
10 | );
11 |
12 | CREATE TABLE IF NOT EXISTS COURSE
13 | ( courseno INTEGER(9),
14 | cname VARCHAR(20),
15 | dept VARCHAR(20),
16 | PRIMARY KEY(courseno)
17 | );
18 |
19 | CREATE TABLE IF NOT EXISTS ENROL
20 | ( regno VARCHAR(9),
21 | courseno INTEGER(9),
22 | sem INTEGER(9) ,
23 | marks INTEGER(5),
24 | PRIMARY KEY(regno,courseno),
25 | FOREIGN KEY(regno) REFERENCES STUDENT(regno),
26 | FOREIGN KEY(courseno) REFERENCES COURSE(courseno)
27 | );
28 |
29 | CREATE TABLE IF NOT EXISTS TEXT
30 | ( book_isbn INTEGER(9),
31 | book_title VARCHAR(30),
32 | publisher VARCHAR(23),
33 | author VARCHAR(27),
34 | PRIMARY KEY(book_isbn)
35 | );
36 |
37 | CREATE TABLE IF NOT EXISTS BOOK_ADOPTION
38 | ( courseno INTEGER(9) REFERENCES COURSE(courseno),
39 | book_isbn INTEGER(9) REFERENCES TEXT(book_isbn),
40 | sem INTEGER(9),
41 | PRIMARY KEY(courseno,book_isbn),
42 | FOREIGN KEY(courseno) REFERENCES COURSE(courseno),
43 | FOREIGN KEY(book_isbn) REFERENCES TEXT(book_isbn)
44 | );
45 |
46 |
47 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question3/3iii_soln.sql:
--------------------------------------------------------------------------------
1 | INSERT INTO TEXT VALUES(1013, 'K and R C', 'Tata McGraw Hill', 'Kernighan and Ritchie');
2 | INSERT INTO BOOK_ADOPTION VALUES(101, 1013, 7);
3 | SELECT * FROM TEXT;
4 | SELECT * FROM BOOK_ADOPTION ;
5 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question3/3iv_soln.sql:
--------------------------------------------------------------------------------
1 | SELECT book_title,b.book_isbn,courseno FROM TEXT t,BOOK_ADOPTION b
2 | WHERE t.book_isbn=b.book_isbn AND courseno IN (
3 | SELECT courseno FROM BOOK_ADOPTION
4 | WHERE courseno IN (SELECT courseno FROM COURSE WHERE dept='Computer Science')
5 | GROUP BY courseno HAVING count(courseno)>2)
6 | ORDER BY book_title;
7 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question3/3v_soln.sql:
--------------------------------------------------------------------------------
1 | SELECT c.dept,b.book_isbn,t.book_title,t.publisher
2 | FROM COURSE c,BOOK_ADOPTION b,TEXT t
3 | WHERE c.courseno=b.courseno AND b.book_isbn=t.book_isbn AND c.dept='Computer Science'AND t.publisher='Tata McGraw Hill';
4 |
5 | #You can replace values for c.dept and t.publisher with suitable values for other departments and publishers
6 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question4/4i_create.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE BOOK;
2 | USE BOOK;
3 | CREATE TABLE IF NOT EXISTS AUTHOR
4 | ( authorid INTEGER(8),
5 | aname VARCHAR(25),
6 | acity VARCHAR(15),
7 | acountry VARCHAR(15),
8 | PRIMARY KEY(authorid)
9 | );
10 |
11 | CREATE TABLE IF NOT EXISTS PUBLISHER
12 | ( publisherid INTEGER(8),
13 | pname VARCHAR(25),
14 | pcity VARCHAR(15),
15 | pcountry VARCHAR(15),
16 | PRIMARY KEY(publisherid)
17 | );
18 |
19 | CREATE TABLE IF NOT EXISTS CATEGORY
20 | ( categoryid INTEGER(8),
21 | description VARCHAR(25),
22 | PRIMARY KEY(categoryid)
23 | );
24 |
25 | CREATE TABLE IF NOT EXISTS CATALOG
26 | ( bookid INTEGER(8),
27 | title VARCHAR(25),
28 | authorid INTEGER(8) ,
29 | publisherid INTEGER(8),
30 | categoryid INTEGER(8),
31 | year INTEGER(4),
32 | price DECIMAL(6,2),
33 | PRIMARY KEY(bookid),
34 | FOREIGN KEY(authorid) REFERENCES AUTHOR(authorid),
35 | FOREIGN KEY(publisherid) REFERENCES PUBLISHER(publisherid),
36 | FOREIGN KEY(categoryid) REFERENCES CATEGORY(categoryid)
37 | );
38 |
39 | CREATE TABLE IF NOT EXISTS ORDER_DETAILS
40 | ( orderno INTEGER(8),
41 | bookid INTEGER(8),
42 | quantity INTEGER(8),
43 | PRIMARY KEY(orderno),
44 | FOREIGN KEY(bookid) REFERENCES CATALOG(bookid)
45 | );
46 |
47 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question4/4iii_soln.sql:
--------------------------------------------------------------------------------
1 | SELECT a.authorid,aname,price,title,year FROM AUTHOR a,CATALOG c
2 | WHERE a.authorid=c.authorid
3 | AND year>2000
4 | AND price>(SELECT avg(price) FROM CATALOG)
5 | AND a.authorid IN (SELECT authorid FROM CATALOG GROUP BY authorid HAVING count(authorid)>=1);
6 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question4/4iv_soln.sql:
--------------------------------------------------------------------------------
1 | SELECT a.aname FROM AUTHOR a,CATALOG c WHERE a.authorid=c.authorid AND
2 | c.bookid IN (SELECT bookid FROM ORDER_DETAILS GROUP BY bookid HAVING
3 | SUM(quantity)>=ALL(SELECT SUM(quantity) FROM ORDER_DETAILS GROUP BY bookid));
4 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question4/4v_soln.sql:
--------------------------------------------------------------------------------
1 | UPDATE CATALOG SET price=(1.10*price) WHERE publisherid =
2 | (SELECT publisherid FROM PUBLISHER WHERE pname ='Pearson Education');
3 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question5/5i_create.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE BANK;
2 | USE BANK;
3 | CREATE TABLE IF NOT EXISTS BRANCH
4 | ( branchname VARCHAR(15),
5 | branchcity VARCHAR(15),
6 | assets DECIMAL(10,2),
7 | PRIMARY KEY(branchname)
8 | );
9 |
10 | CREATE TABLE IF NOT EXISTS ACCOUNT
11 | ( accno INTEGER(8),
12 | branchname VARCHAR(15),
13 | balance DECIMAL(10,2),
14 | PRIMARY KEY(accno),
15 | FOREIGN KEY(branchname) REFERENCES BRANCH(branchname)ON DELETE CASCADE
16 | );
17 |
18 | CREATE TABLE IF NOT EXISTS CUSTOMER
19 | ( customername VARCHAR(15),
20 | customerstreet VARCHAR(15),
21 | customercity VARCHAR(15),
22 | PRIMARY KEY(customername)
23 | );
24 |
25 | CREATE TABLE IF NOT EXISTS LOAN
26 | ( loan_number INTEGER(8),
27 | branchname VARCHAR(15),
28 | amount DECIMAL(10,2),
29 | PRIMARY KEY(loan_number),
30 | FOREIGN KEY(branchname) REFERENCES BRANCH(branchname)
31 |
32 | );
33 |
34 | CREATE TABLE IF NOT EXISTS DEPOSITOR
35 | ( customername VARCHAR(15),
36 | accno INTEGER,
37 | PRIMARY KEY(customername, accno),
38 | FOREIGN KEY(customername) REFERENCES CUSTOMER(customername),
39 | FOREIGN KEY(accno) REFERENCES ACCOUNT(accno)
40 | );
41 |
42 | CREATE TABLE IF NOT EXISTS BORROWER
43 | ( customername VARCHAR(15),
44 | loan_number INTEGER(8),
45 | PRIMARY KEY(customername, loan_number),
46 | FOREIGN KEY(customername) REFERENCES CUSTOMER(customername),
47 | FOREIGN KEY(loan_number) REFERENCES LOAN(loan_number)
48 | );
49 |
50 |
51 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question5/5iii_soln.sql:
--------------------------------------------------------------------------------
1 | SELECT customername FROM DEPOSITOR D,ACCOUNT A WHERE
2 | D.accno=A.accno AND A.branchname='Main'
3 | GROUP BY D.customername HAVING COUNT(D.customername)>1;
4 |
5 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question5/5iv_soln.sql:
--------------------------------------------------------------------------------
1 | CREATE VIEW BANKVIEW AS(
2 | SELECT DISTINCT customername,b.branchname,branchcity
3 | FROM DEPOSITOR d,ACCOUNT a,BRANCH b
4 | WHERE d.accno=a.accno AND a.branchname=b.branchname AND b.branchcity='Bangalore');
5 |
6 | SELECT customername
7 | FROM BANKVIEW
8 | GROUP BY customername
9 | HAVING count(customername)=(
10 | SELECT count(*)
11 | FROM BRANCH
12 | WHERE branchcity='Bangalore');
13 |
14 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/.old/Question5/5v_soln.sql:
--------------------------------------------------------------------------------
1 | DELETE FROM ACCOUNT
2 | WHERE branchname IN (SELECT branchname
3 | FROM BRANCH
4 | WHERE branchcity='Bangalore');
5 |
6 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/00_Introduction_to_MySQL/DBScreenShots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem5/DB_Lab/00_Introduction_to_MySQL/DBScreenShots/1.png
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/00_Introduction_to_MySQL/DBScreenShots/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem5/DB_Lab/00_Introduction_to_MySQL/DBScreenShots/2.png
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/00_Introduction_to_MySQL/DBScreenShots/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem5/DB_Lab/00_Introduction_to_MySQL/DBScreenShots/3.png
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/00_Introduction_to_MySQL/DBScreenShots/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem5/DB_Lab/00_Introduction_to_MySQL/DBScreenShots/4.png
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/00_Introduction_to_MySQL/DBScreenShots/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem5/DB_Lab/00_Introduction_to_MySQL/DBScreenShots/5.png
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/00_Introduction_to_MySQL/DBScreenShots/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem5/DB_Lab/00_Introduction_to_MySQL/DBScreenShots/6.png
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/Back.md:
--------------------------------------------------------------------------------
1 | 
2 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/Content.md:
--------------------------------------------------------------------------------
1 | # Content
2 |
3 | 1. Foreword
4 | 2. Contributors
5 | 3. About
6 | 4. Introduction to MySQL
7 | 5. Syllabus
8 | 6. Problem 1: Student Class
9 | 7. Problem 2: Airline Flight
10 | 8. Problem 3: Student Course Books
11 | 9. Problem 4: Book dealer
12 | 10. Problem 5: Banking Enterprise
13 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/DB_CSE_5thSem.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem5/DB_Lab/DB_CSE_5thSem.pdf
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/SUMMARY.md:
--------------------------------------------------------------------------------
1 | # Summary
2 |
3 | * [Content](Content.md)
4 | * [Foreword](Foreword.md)
5 | * [Contributors](Contributors.md)
6 | * [About](About.md)
7 | * [Introduction to MySQL](00_Introduction_to_MySQL/Introduction_to_MySQL.md)
8 | * [Syllabus](SYLLABUS.md)
9 | * [Problem 1: Student Class](01_StudentClass/01_StudentClass.md)
10 | * [Problem 2: Airline Flight](02_AirlineFlight/02_AirlineFlight.md)
11 | * [Problem 3: Student Course Books](03_StudentCoursesBooks/03_StudentCoursesBooks.md)
12 | * [Problem 4: Book dealer](04_BookDealer/04_BookDealer.md)
13 | * [Problem 5: Banking Enterprise](05_BankingEnterprise/05_BankingEnterprise.md)
14 |
15 |
16 |
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem5/DB_Lab/back.png
--------------------------------------------------------------------------------
/VTU/Sem5/DB_Lab/cover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem5/DB_Lab/cover.png
--------------------------------------------------------------------------------
/VTU/Sem5/Readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem5/Readme.txt
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/11.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | int main()
4 | {
5 | int n,a[100],i;
6 | omp_set_num_threads(2);
7 | printf("enter the no of terms of fibonacci series which have to be generated\n");
8 | scanf("%d",&n);
9 | a[0]=0;
10 | a[1]=1;
11 | #pragma omp parallel
12 | {
13 | #pragma omp single
14 | for(i=2;i
3 | int char_count=0,word_count=0,line_count=0,space_count=0;
4 | %}
5 | %%
6 | [^ \t\n]+ {word_count++;char_count+=yyleng;}
7 | \n {line_count++;char_count++;}
8 | " " {space_count++;char_count++;}
9 | . {char_count++;}
10 | %%
11 | int main(int argc,char *argv[])
12 | {
13 | if(argc>1)
14 | {
15 | FILE *file=fopen(argv[1],"r");
16 | if(!file)
17 | {
18 | printf("Error opening %s\n",argv[1]);
19 | exit(1);
20 | }
21 | yyin=file;
22 | }
23 | yylex();
24 | printf("line count is %d\n",line_count);
25 | printf("word count is %d\n",word_count);
26 | printf("space count is %d\n",space_count);
27 | printf("character count is %d\n",char_count);
28 | return 0;
29 | }
30 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/1b.l:
--------------------------------------------------------------------------------
1 | %{
2 | #include
3 | int c=0;
4 | %}
5 | %x COMMENT
6 | %%
7 | "//".* {c++;}
8 | "/*".* {BEGIN COMMENT;}
9 | . ;
10 | \n ;
11 | "*/" {BEGIN 0;c++;}
12 | %%
13 | int main(int argc,char **argv)
14 | {
15 | if(argc!=3)
16 | {
17 | printf("No file\n");
18 | return 0;
19 | }
20 | else
21 | {
22 | yyin=fopen(argv[1],"r");
23 | yyout=fopen(argv[2],"w");
24 | yylex();
25 | printf("Number of comments is %d\n",c);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/2a.l:
--------------------------------------------------------------------------------
1 | %{
2 | #include
3 | int a[4]={0,0,0,0};
4 | int valid=1,i;
5 | int nop=0;
6 | %}
7 | %x OPER
8 | %%
9 | [a-zA-Z0-9]+ {BEGIN OPER;nop++;}
10 | "+" {if(valid) {valid=0;i=0;}else ext();}
11 | "-" {if(valid) {valid=0;i=1;}else ext();}
12 | "*" {if(valid) {valid=0;i=2;}else ext();}
13 | "/" {if(valid) {valid=0;i=3;}else ext();}
14 | [a-zA-Z0-9]+ {nop++;if(valid==0){valid=1;a[i]++;}else ext();}
15 | . {if(valid){valid=0;ext();}else return 0;}
16 | "\n" {if(valid==0){ext();}else return 0;}
17 | . ext();
18 | \n ext();
19 | %%
20 | int ext()
21 | {
22 | printf("Invalid expression\n");
23 | exit(0);
24 | }
25 | int main()
26 | {
27 | printf("Enter expression\n");
28 | yylex();
29 | printf("Expression is valid\n");
30 | printf("No. of '+' is:%d\n",a[0]);
31 | printf("No. of '-' is:%d\n",a[1]);
32 | printf("No. of '*' is:%d\n",a[2]);
33 | printf("No. of '/' is:%d\n",a[3]);
34 | printf("No. of operands is:%d\n",nop);
35 | return 0;
36 | }
37 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/2b.l:
--------------------------------------------------------------------------------
1 | %{
2 | #include
3 | int valid=1;
4 | %}
5 | id [a-zA-Z0-9]*
6 | %%
7 | {id}" and "{id} {valid=0;}
8 | {id}" or "{id} {valid=0;}
9 | {id}" but "{id} {valid=0;}
10 | {id}" between "{id} {valid=0;}
11 | . ;
12 | \n {return 0;}
13 | %%
14 | main()
15 | {
16 | printf("Enter a sentence\n");
17 | yylex();
18 | if(valid==1)
19 | printf("Its a simple sentence\n");
20 | else
21 | printf("Its a compound sentence\n");
22 | }
23 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/3.l:
--------------------------------------------------------------------------------
1 | %{
2 | #include
3 | int intcount=0,floatcount=0,charcount=0,doublecount=0;
4 | %}
5 | ID [a-zA-Z][a-zA-Z0-9]*
6 | I "int"
7 | F "float"
8 | C "char"
9 | D "double"
10 | %s DEFN
11 | %s DEFN2
12 | %s DEFN3
13 | %s DEFN4
14 | %%
15 | [\t] ;
16 | {I} {BEGIN DEFN;}
17 | {ID}"," {intcount++;printf("%s\n",yytext);}
18 | {ID}";" {intcount++;BEGIN 0;printf("%s\n",yytext);}
19 | {F} {BEGIN DEFN2;}
20 | {ID}"," {floatcount++;printf("%s\n",yytext);}
21 | {ID}";" {floatcount++;BEGIN 0;printf("%s\n",yytext);}
22 | {C} {BEGIN DEFN3;}
23 | {ID}"," {charcount++;printf("%s\n",yytext);}
24 | {ID}";" {charcount++;BEGIN 0;printf("%s\n",yytext);}
25 | {D} {BEGIN DEFN4;}
26 | {ID}"," {doublecount++;printf("%s\n",yytext);}
27 | {ID}";" {doublecount++;BEGIN 0;printf("%s\n",yytext);}
28 | . ;
29 | \n ;
30 | %%
31 | int main(int argc,char **argv)
32 | {
33 | if(argc!=2)
34 | {
35 | printf("Error\n");
36 | return 0;
37 | }
38 | yyin=fopen(argv[1],"r");
39 | printf("The identifiers are:\n");
40 | yylex();
41 | printf("the no. of int identifiers are %d\n",intcount);
42 | printf("the no. of float identifiers are %d\n",floatcount);
43 | printf("the no. of char identifiers are %d\n",charcount);
44 | printf("the no. of double identifiers are %d\n",doublecount);
45 | return 0;
46 | }
47 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/4a.l:
--------------------------------------------------------------------------------
1 | %{
2 | #include"y.tab.h"
3 | %}
4 | %%
5 | [0-9]+ return NUMBER;
6 | [a-zA-Z][a-zA-Z0-9]* return ID;
7 | . return yytext[0];
8 | \n return 0;
9 | %%
10 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/4a.y:
--------------------------------------------------------------------------------
1 | %{
2 | #include
3 | #include
4 | %}
5 | %token NUMBER ID
6 | %left '+''-'
7 | %left '*''/'
8 | %%
9 | exp:exp'+'exp
10 | |exp'-'exp
11 | |exp'*'exp
12 | |exp'/'exp
13 | |NUMBER
14 | |ID;
15 | %%
16 | yyerror()
17 | {
18 | printf("Invalid expression\n");
19 | exit(0);
20 | }
21 | int main()
22 | {
23 | printf("Enter the expression\n");
24 | yyparse();
25 | printf("Valid expression\n");
26 | return 0;
27 | }
28 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/4b.l:
--------------------------------------------------------------------------------
1 | %{
2 | #include"y.tab.h"
3 | %}
4 | %%
5 | [0-9] return DIGIT;
6 | [a-zA-Z] return ALPHA;
7 | . return yytext[0];
8 | \n return 0;
9 | %%
10 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/4b.y:
--------------------------------------------------------------------------------
1 | %{
2 | #include
3 | #include
4 | %}
5 | %token DIGIT ALPHA
6 | %%
7 | variable:ALPHA
8 | |variable ALPHA
9 | | variable DIGIT
10 | ;
11 | %%
12 | yyerror()
13 | {
14 | printf("Invalid expression\n");
15 | exit(0);
16 | }
17 | int main()
18 | {
19 | printf("Enter the variable\n");
20 | yyparse();
21 | printf("Valid variable\n");
22 | return 0;
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/5a.l:
--------------------------------------------------------------------------------
1 | %{
2 | #include"y.tab.h"
3 | extern int yylval;
4 | %}
5 | [0-9]+ {yylval=atoi(yytext);return NUMBER;}
6 | . return yytext[0]
7 | \n return 0;
8 | %%
9 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/5a.y:
--------------------------------------------------------------------------------
1 | %{
2 | #include
3 | #include
4 | %}
5 | %token NUMBER
6 | %left '+''-'
7 | %left '*''/'
8 | %%
9 | exp:expr {printf("Result is %d\n",$1);return 0;}
10 | expr:expr'+'expr {$$=$1+$3;}
11 | |expr'-'expr {$$=$1-$3;}
12 | |expr'*'expr {$$=$1*$3;}
13 | |expr'/'expr
14 | {
15 | if($3==0)
16 | yyerror("divide by zero!!!");
17 | else
18 | $$=$1/$3'
19 | }
20 | |'('expr')' {$$=$2;}
21 | |NUMBER
22 | ;
23 | %%
24 | yyerror()
25 | {
26 | printf("Invalid expression\n");
27 | exit(0);
28 | }
29 | main()
30 | {
31 | printf("Enter the expression\n");
32 | yyparse();
33 | printf("Valid expression\n");
34 | }
35 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/5b.l:
--------------------------------------------------------------------------------
1 | %{
2 | #include"y.tab.h"
3 | %}
4 | %%
5 | a return A;
6 | b return B;
7 | . return yytext[0];
8 | \n return 0;
9 | %%
10 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/5b.y:
--------------------------------------------------------------------------------
1 | %{
2 | #include
3 | #include
4 | %}
5 | % token A B;
6 | %%
7 | S:A S B
8 | |
9 | ;
10 | %%
11 | yyerror()
12 | {
13 | printf("Invalid\n");
14 | exit(0);
15 | }
16 | main()
17 | {
18 | printf("enter a string of a's and b's\n");
19 | yyparse();
20 | printf("valid grammar\n");
21 | }
22 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/6.l:
--------------------------------------------------------------------------------
1 | %{
2 | #include"y.tab.h"
3 | %}
4 | %%
5 | a return A;
6 | b return B;
7 | . return yytext[0];
8 | \n return 0;
9 | %%
10 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/6.y:
--------------------------------------------------------------------------------
1 | %{
2 | #include
3 | #include
4 | int count=0;
5 | %}
6 | % token A B;
7 | %%
8 | S: X B
9 | X: X A {count++;}
10 | |
11 | ;
12 | %%
13 | yyerror()
14 | {
15 | printf("Invalid\n");
16 | exit(0);
17 | }
18 | main()
19 | {
20 | printf("enter a string of a's and b's\n");
21 | yyparse();
22 | if(count>=10)
23 | printf("valid grammar\n");
24 | else
25 | printf("Invalid grammar\n");
26 | }
27 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/7a.sh:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 | if [ $# -eq 0 ]
3 | then
4 | echo "no arguments"
5 | exit
6 | fi
7 | echo "the total number of arguments are $#"
8 | echo "the arguments are $*"
9 | for i in $@
10 | do
11 | rev=$i" "$rev
12 | done
13 | echo "$rev"
14 |
15 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/7b.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main()
5 | {
6 | char cmd[10];
7 | int ch;
8 | pid_t pid;
9 | if((pid=fork())<0)
10 | {
11 | printf("fork error\n");
12 | return 0;
13 | }
14 | if(pid==0)
15 | {
16 | printf("i am parent process\n");
17 | printf("process id =%d\n",getpid());
18 | printf("parent process id=%d\n",getppid());
19 | scanf("%s",cmd);
20 | system(cmd);
21 |
22 | }
23 | else
24 | {
25 | printf("%d",getpid());
26 | printf("%d",getppid());
27 | wait();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/8a.sh:
--------------------------------------------------------------------------------
1 |
2 | #!/bin/sh
3 |
4 | if [ $# -ne 2 ]
5 | then
6 | echo " please enter 2 arguments"
7 | exit
8 | fi
9 | perm1=`ls -l $1|cut -c 1-10`
10 | perm2=`ls -l $2|cut -c 1-10`
11 | if [ $perm1 = $perm2 ]
12 | then
13 | echo "Permissions are same for both files"
14 | echo "permissions are: $perm1"
15 | exit
16 | fi
17 | str1=`ls -l $1|cut -c 2-4`
18 | str2=`ls -l $2|cut -c 2-4`
19 | if [ $str1 = $str2 ]
20 | then
21 | echo "Owner permissions are same: $str1 "
22 | else
23 | echo "Owner permissions are different"
24 | echo " Permissions for file $1 : $str1 "
25 | echo " Permissions for file $2 : $str2 "
26 | fi
27 | str3=`ls -l $1|cut -c 5-7`
28 | str4=`ls -l $2|cut -c 5-7`
29 | if [ $str3 = $str4 ]
30 | then
31 | echo "Group permissions are same: $str3 "
32 | else
33 | echo "Group permissions are different"
34 | echo " Permissions for file $1 : $str3 "
35 | echo " Permissions for file $2 : $str4 "
36 | fi
37 | str5=`ls -l $1|cut -c 8-10`
38 | str6=`ls -l $2|cut -c 8-10`
39 | if [ $str5 = $str6 ]
40 | then
41 | echo "Other's permissions are same: $str5 "
42 | else
43 | echo "Other's permissions are different"
44 | echo " Permissions for file $1 : $str5 "
45 | echo " Permissions for file $2 : $str6 "
46 | fi
47 |
48 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/8b.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | int main()
6 | {
7 | int fd;
8 | char buf2[16]="ABCDEFGHIJKLMNOP";
9 | char buf1[16]="abcdefghijklmnop";
10 |
11 | fd=open("data.txt",O_RDWR|O_CREAT|O_EXCL,0765);
12 |
13 | if(fd==-1)
14 | printf("Error creating file");
15 | else
16 | write(fd,buf1,16);
17 | lseek(fd,32,SEEK_CUR);
18 | write(fd,buf2,16);
19 | system(" vi data.txt");
20 | close(fd);
21 | }
22 |
23 |
24 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/9a.sh:
--------------------------------------------------------------------------------
1 | if [ $# -eq 0 ]
2 | then
3 | echo "error"
4 | exit
5 | fi
6 | for i in $*
7 | do
8 | echo "extracting $i file" >> f.sh
9 | cat $i >> f.sh
10 | echo "EOF" >> f.sh
11 | done
12 | cat f.sh
13 |
14 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/.old/9b.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | int main()
5 | {
6 | pid_t p;
7 | if((p=fork())<0)
8 | {
9 | printf("fork error\n");
10 | return 0;
11 | }
12 | else if(p==0)
13 | {
14 | printf("i am child process\n");
15 | printf("my parent process id is:%d\n",getppid());
16 | printf("my process id is:%d\n",getpid());
17 | }
18 | else
19 | {
20 | wait();
21 | printf("i am parent process\n");
22 | printf("my child process id is:%d\n",p);
23 | printf("my own id is: %d\n",getpid());
24 | }
25 | return 0;
26 | }
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/01aCharacterCount/01aCharacterCount.md:
--------------------------------------------------------------------------------
1 | # AIM:
2 | Program to count the number of characters, words, spaces and lines
3 | in a given input file.
4 |
5 | ## DESCRIPTION:
6 | We have the command 'wc' in UNIX which gives us all the
7 | number of characters,number of words,number of lines.We are expected to develop a similar utility which does the same using flex.
8 |
9 | ## FLEX: flex - the fast lexical analyser generator.
10 |
11 |
12 |
13 |
14 | ## CODE:
15 |
16 |
line count is 29
53 | word count is 55
54 | space count is 26
55 | character count is 588
56 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/02bRecognizeSentence/02bRecognizeSentence.md:
--------------------------------------------------------------------------------
1 | # AIM:
2 | Program to recognize whether a given sentence is simple or compound.
3 | ## DESCRIPTION:
4 | The user is expected to develop a code which recognizes a sentence as either simple or compound.The design considers that we use and, or, but & between.The user can specify more rules as per his/her choice.
5 |
6 | ## CODE:
7 |
%{
8 | `#`include<stdio.h>
9 | int valid=1;
10 | %}
11 | id [a-zA-Z0-9]*
12 | %%
13 | {id}" and "{id} {valid=0;}
14 | {id}" or "{id} {valid=0;}
15 | {id}" but "{id} {valid=0;}
16 | {id}" between "{id} {valid=0;}
17 | . ;
18 | \n {return 0;}
19 | %%
20 | main()
21 | {
22 | printf("Enter a sentence\n");
23 | yylex();
24 | if(valid==1)
25 | printf("Its a simple sentence\n");
26 | else
27 | printf("Its a compound sentence\n");
28 | }
29 | ## OUTPUT:
30 |
Enter a sentence
31 | hi and bye
32 | Its a compound sentence
33 |
34 |
Enter a sentence
35 | anand
36 | Its a simple sentence
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/04bRecognizeVariable/04bRecognizeVariable.md:
--------------------------------------------------------------------------------
1 | ## Program : 4b.y
2 | ## Aim:
3 | Program to recognize a valid variable, which starts with a letter, followed by any number of letters or digits.
4 |
5 | ## Description:
6 | This program checks if the given variable is valid or invalid. A variable should start with a letter followed any no of letters or digits.For example a123 or aa23 or b3455 etc are valid variables.Example for invalid expression 12aa or 1cc etc.
7 |
8 | ## Code:
9 |
10 | %{
11 | #include
12 | #include
13 | %}
14 | %token DIGIT ALPHA
15 | %%
16 | variable:ALPHA
17 | |variable ALPHA
18 | | variable DIGIT
19 | ;
20 | %%
21 | yyerror()
22 | {
23 | printf("Invalid expression\n");
24 | exit(0);
25 | }
26 | int main()
27 | {
28 | printf("Enter the variable\n");
29 | yyparse();
30 | printf("Valid variable\n");
31 | return 0;
32 | }
33 |
34 | ## Program : 4b.l (Lex Specification)
35 |
36 | ## Code:
37 | %{
38 | #include"y.tab.h"
39 | %}
40 | %%
41 | [0-9] return DIGIT;
42 | [a-zA-Z] return ALPHA;
43 | . return yytext[0];
44 | \n return 0;
45 | %%
46 |
47 |
48 | ## Output:
49 | 1.Enter the variable
50 |
51 | a345
52 |
53 | Valid variable
54 |
55 | 2.Enter the variable
56 |
57 | 34aaa
58 |
59 | Invalid expression
60 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/05bRecognizeStrings/05bRecognizeStrings.md:
--------------------------------------------------------------------------------
1 | ## AIM :Program to recognize strings 'aaab', 'abbb', 'ab' and 'a' using the grammar (anbn, n>= 0).
2 |
3 |
4 | ### DESCRIPTION :
5 |
The program has three parts defination section,rule section,subroutine section. The program accepts equal number of a's and b's as valid inputs. The grammar is S->A S B, A->a ,b->b .
enter a string of a's and b's
52 | aaab
53 | Invalid grammar
54 |
55 | enter a string of a's and b's
56 | abbb
57 | Invalid grammar
58 |
59 | enter a string of a's and b's
60 | ab
61 | valid grammar
62 |
63 | enter a string of a's and b's
64 | a
65 | Invalid grammar
The program has three parts:definition section,rule section,subroutine section. The program uses a variable count to keep track of the number of A's in the input string and B is accepted only once according to the rule described.So count must be more than 9.
57 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/07aReverseOrder/07aReverseOrder.md:
--------------------------------------------------------------------------------
1 | ### Aim:
2 | Non-recursive shell script that accepts any number of arguments and prints them in the Reverse order, ( For example, if the script is named rargs, then executing rargs A B C should produce C B A on the standard output).
3 |
4 | #### Description:
5 |
$#: Contains the total number of input arguments.
6 |
$@:Contains all the input arguments
7 |
8 |
#! /bin/bash
9 | if [ $# -eq 0 ]
10 | then
11 | echo "no arguments"
12 | exit
13 | fi
14 | echo "the total number of arguments are $#"
15 | echo "the arguments are $*"
16 | for i in $@
17 | do
18 | rev=$i" "$rev
19 | done
20 | echo "$rev"
21 |
22 | #### Output:
23 |
./7a.sh 2 7 5
24 | 5 7 2
25 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/07bShellLikeProgram/07bShellLikeProgram.md:
--------------------------------------------------------------------------------
1 | ### Aim:
2 | C program that creates a child process to read commands from the standard input and execute them (a minimal implementation of a shell-like program). You can assume that no arguments will be passed to the commands to be executed.
3 |
4 | #### Description:
5 |
fork():it is a system call which forks a new child of a processs
6 |
system ():it is a system call which takes a command as an argument and invokes the operating system to execute it.
7 |
8 | #### Code:
9 |
40 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/09aBundleScript/09aBundleScript.md:
--------------------------------------------------------------------------------
1 | ### Aim:
2 | Shell script that accepts file names specified as arguments and creates a shell script that contains this file as well as the code to recreate these files. Thus if the script generated by your script is executed, it would recreate the original files(This is same as the "bundle" script described by Brain W. Kernighan and Rob Pike in "The Unix Programming Environment", Prentice - Hall India).
3 |
4 | #### Description:
5 |
$#: Contains the total number of input arguments.
6 |
$@:Contains all the input arguments
7 | #### Code:
8 |
if [ $# -eq 0 ]
9 | then
10 | echo "error"
11 | exit
12 | fi
13 | for i in $*
14 | do
15 | echo "extracting $i file" >> f.sh
16 | cat $i >> f.sh
17 | echo "EOF" >> f.sh
18 | done
19 | cat f.sh
20 |
--------------------------------------------------------------------------------
/VTU/Sem5/SS_OS_Lab/09bChildProcessIDs/09bChildProcessIDs.md:
--------------------------------------------------------------------------------
1 | ### Aim:
2 | C program to do the following: Using fork( ) create a child process.The child process prints its own process-id and id of its parent and then exits. The parent process waits for its child to finish (by executing the wait( )) and prints its own process-id and the id of its child process and then exits.
3 |
4 | ### Description:
5 |
pid_t:parent id of the process.
6 |
fork():it is a system call which forks a new child of a processs
7 |
8 | ### Code:
9 |
`#`include<stdio.h>
10 | `#`include<unistd.h>
11 | `#`include<stdlib.h>
12 | int main()
13 | {
14 | pid_t p;
15 | if((p=fork())<0)
16 | {
17 | printf("fork error\n");
18 | return 0;
19 | }
20 | else if(p==0)
21 | {
22 | printf("i am child process\n");
23 | printf("my parent process id is:%d\n",getppid());
24 | printf("my process id is:%d\n",getpid());
25 | }
26 | else
27 | {
28 | wait();
29 | printf("i am parent process\n");
30 | printf("my child process id is:%d\n",p);
31 | printf("my own id is: %d\n",getpid());
32 | }
33 | return 0;
34 | }
35 |
36 | ### Output:
37 |
i am child process
38 | my parent process id is:4273
39 | my process id is:4274
40 | i am parent process
41 | my child process id is:4274
42 | my own id is: 4273
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/VTU/Sem6/CG_Lab/02LiangBasky/liang.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/CG_Lab/02LiangBasky/liang.png
--------------------------------------------------------------------------------
/VTU/Sem6/CG_Lab/02LiangBasky/liangAlgo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/CG_Lab/02LiangBasky/liangAlgo.png
--------------------------------------------------------------------------------
/VTU/Sem6/CG_Lab/03SpinCube/spincube.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/CG_Lab/03SpinCube/spincube.png
--------------------------------------------------------------------------------
/VTU/Sem6/CG_Lab/04RotateHouse/rthouse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/CG_Lab/04RotateHouse/rthouse.png
--------------------------------------------------------------------------------
/VTU/Sem6/CG_Lab/05CohenSutherland/cohen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/CG_Lab/05CohenSutherland/cohen.png
--------------------------------------------------------------------------------
/VTU/Sem6/CG_Lab/06parallelopiped/parallelopiped.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/CG_Lab/06parallelopiped/parallelopiped.png
--------------------------------------------------------------------------------
/VTU/Sem6/CG_Lab/07teapot/teapot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/CG_Lab/07teapot/teapot.png
--------------------------------------------------------------------------------
/VTU/Sem6/CG_Lab/08moveCube/movecube.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/CG_Lab/08moveCube/movecube.png
--------------------------------------------------------------------------------
/VTU/Sem6/CG_Lab/09scanFill/scanfill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/CG_Lab/09scanFill/scanfill.png
--------------------------------------------------------------------------------
/VTU/Sem6/CG_Lab/10rectMesh/mesh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/CG_Lab/10rectMesh/mesh.png
--------------------------------------------------------------------------------
/VTU/Sem6/CG_Lab/CG.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/CG_Lab/CG.pdf
--------------------------------------------------------------------------------
/VTU/Sem6/Readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/Readme.txt
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/.old/C_files/01_get_limits.cpp:
--------------------------------------------------------------------------------
1 | /*Write a C/C++ POSIX compliant program to check the following limits:
2 | (i) No. of clock ticks
3 | (ii) Max. no. of child processes
4 | (iii) Max. path length
5 | (iv) Max. no. of characters in a file name
6 | (v) Max. no. of open files/ process
7 | */
8 |
9 |
10 | #define _POSIX_SOURCE
11 | #define _POSIX_C_SOURCE 199309L
12 | #include "iostream"
13 | #include
14 | using namespace std;
15 | int main()
16 | {
17 | cout<<"No of clock ticks:"<
8 | using namespace std;
9 | int main()
10 | {
11 | #ifdef _POSIX_JOB_CONTROL
12 | cout<<"System supports POSIX job control:"<<_POSIX_JOB_CONTROL<
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | using namespace std;
14 | #define BUFFER_SIZE PIPE_BUF
15 | int main(int argc,char *argv[])
16 | {
17 | int pipe_fd,res=0;
18 | char buffer[BUFFER_SIZE+1];
19 | if(argc!=2)
20 | {
21 | cout<<"usage:./a.out pipe_name\n";
22 | return -1;
23 | }
24 | cout<<"\nFD of fifo in read mode:"<
5 | #include
6 | #include
7 | static void charatatime(char *);
8 | int main()
9 | {
10 | int pid;
11 | if((pid=fork())<0)
12 | printf("fork error\n");
13 | else if(pid==0)
14 | charatatime("output from child\n");
15 | else
16 | charatatime("output from parent\n");
17 | _exit(0);
18 | }
19 | static void charatatime(char *str)
20 | {
21 | char *ptr;
22 | int c;
23 | setbuf(stdout,NULL);
24 | for(ptr=str;(c=*ptr++)!=0;)
25 | putc(c,stdout);
26 | }
27 |
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/.old/C_files/07_zombie.c:
--------------------------------------------------------------------------------
1 | ##Aim:
2 |
3 | /* Write a C/C++ program that creates a zombie and then calls system to execute the ps
4 | command to verify that the process is zombie. */
5 | #include
6 | #include
7 | #include
8 | int main()
9 | {
10 | int pid;
11 | if((pid=fork())<0)
12 | printf("fork error\n");
13 | else if(pid==0)
14 | _exit(0);
15 | sleep(2);
16 | system( "ps -o pid,ppid,state,tty,command");
17 | _exit(0);
18 | }
19 |
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/.old/C_files/08_avoid_zombie.c:
--------------------------------------------------------------------------------
1 | /*Write a C/C++ program to avoid zombie process by forking twice.*/
2 | #include
3 | #include
4 | #include
5 | int main()
6 | {
7 | int pid;
8 | if((pid=fork())<0)
9 | printf("fork error\n");
10 | else if(pid==0)
11 | {
12 | if((pid=fork())<0)
13 | printf("fork error\n");
14 | else if(pid>0)
15 | _exit(0);
16 | sleep(2);
17 | printf("second child,parent pid:%d\n",getppid());
18 | _exit(0);
19 | }
20 | _exit(0);
21 | }
22 |
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/.old/C_files/09_my_system.c:
--------------------------------------------------------------------------------
1 | /*Write a C/C++ program to implement the system function.*/
2 | /* Note : TO run use ./a.out command1 command2 ,..., commandn
3 | where each command is a shell command
4 | Example : ./a.out ps date who
5 | */
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | void sys(const char *cmdstr)
13 | {
14 | int pid;
15 | pid=fork();
16 | if(pid==0)
17 | execl("/bin/bash","bash","-c",cmdstr,NULL);
18 | else
19 | waitpid(pid,NULL,0);
20 | }
21 | int main(int argc,char *argv[])
22 | {
23 | int i;
24 | for(i=1;i
3 | #include
4 | #include
5 | #include
6 | #define INTERVAL 5
7 | void callme(int sig_no)
8 | {
9 | alarm(INTERVAL);
10 | printf("Hello!!\n");
11 | }
12 | int main()
13 | {
14 | struct sigaction action;
15 | action.sa_handler=(void(*)(int))callme;
16 | sigaction(SIGALRM,&action,0);
17 | alarm(2);
18 | sleep(5);
19 | return 0;
20 | }
21 |
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/.old/usp-lab-07/usp-lab-07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/USP_CD_Lab/.old/usp-lab-07/usp-lab-07.png
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/01GetLimits/usp-lab-01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/USP_CD_Lab/01GetLimits/usp-lab-01.png
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/02PosixConfiguration/02_output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/USP_CD_Lab/02PosixConfiguration/02_output.png
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/03FileLock/out1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/USP_CD_Lab/03FileLock/out1.png
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/03FileLock/out2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/USP_CD_Lab/03FileLock/out2.png
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/03FileLock/out3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/USP_CD_Lab/03FileLock/out3.png
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/04IpcFifoReader/pipe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/USP_CD_Lab/04IpcFifoReader/pipe.png
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/04IpcFifoReader/usp-lab-04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fsmk/CS-VTU-Lab-Manual/50f7594cf6ec770cdd9c5ac6dbfd75c03d6aedec/VTU/Sem6/USP_CD_Lab/04IpcFifoReader/usp-lab-04.png
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/05aEnvironList/5a_environlist.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | int main(int argc,char *argv[])
4 | {
5 | char **ptr;
6 | extern char **environ;
7 | for(ptr=environ; *ptr!=0;ptr++)
8 | printf("%s\n",*ptr);
9 | return 0;
10 | }
11 |
--------------------------------------------------------------------------------
/VTU/Sem6/USP_CD_Lab/05aEnvironList/5a_environlist.md:
--------------------------------------------------------------------------------
1 | ## Aim :
2 |
3 | ### Write a C/C++ program thgat output the contents of its Environment list.
4 |
5 |
6 | ## Theory :
7 |
8 | >Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.
9 |
10 | >They are part of the operating environment in which a process runs. For example, a running process can query the value of the TEMP environment variable to discover a suitable location to store temporary files, or the HOME or USERPROFILE variable to find the directory structure owned by the user running the process.
11 |
12 |
13 | ## Code :
14 |
15 |