Skip to main content

Posts

BSc CSIT 4th Sem Old Questions ( 2066-2070)

BSc CSIT 4th Sem Old Questions ( 2066-2070)
Recent posts

C program for Trapezoidal Rule

C Code for Trapezoidal Rule #include <stdio.h> #include <conio.h> #include <math.h> float f(float x) {   return (exp(x)); //f(x)=exp(x); } void main() {   float a,b,h,x,sum=0;   int n;   printf("Enter a and b: ");   scanf("%f%f",&a,&b);   printf("Here, n=1 for Trapezoidal rule");  printf("\nn>1 for Composite Trapezoidal rule\n");   printf("So, Enter n: ");   scanf("%d",&n);   h=(b-a)/n;   for(x=a;x<=b;x=x+h)   {     if(x==a)       sum=sum+f(x);     else if(x==b)       sum=sum+f(x);     else       sum=sum+2*f(x);   }   sum=h/2*sum;   printf("\nI=%f",sum);   getch(); }

C program for Simpsons 1/3 rule

C program for Simpsons 1/3 rule #include <stdio.h> #include <conio.h> #include <math.h> float f(float x) {   return (sqrt(sin(x)));   //f(x)=sqrt(sin(x)); } void main() {   float a,b,h,x,sum=0;   int n,i,k;   printf("Enter a and b: ");   scanf("%f%f",&a,&b);   printf("Here, n=2 for Simpson's 1/3 rule");   printf("\nn>2 for Composite Simpson's 1/3 rule\n");   printf("So, Enter n: ");   scanf("%d",&n);   h=(b-a)/n;   for(x=a,i=0,k=1;x<=b,i<=n;x=x+h,i++,k=k+2)   {     if(i==0||i==n)       sum=sum+f(x);     else if(i==k)       sum=sum+4*f(x);     else       sum=sum+2*f(x);   }   sum=h/3*sum;   printf("\nI=%f",sum);   getch(); }

C Program for Runge-Kutta-4 (RK-4) Method

Program for Runge-Kutta-4 (RK-4) Method #include <stdio.h> #include <conio.h> #include <math.h> float f(float x,float y) {   return ((y*y-x*x)/(y*y+x*x));   //y'=f(x,y)=equation } void main() {   float x0,y0,h,xn,yn;   printf("Enter x0 and y0: ");   scanf("%f%f",&x0,&y0); //y(x0)=y0   printf("Enter xn: ");   scanf("%f",&xn);   printf("Enter interval(h): ");   scanf("%f",&h);   do   {     float m1=f(x0,y0);     float m2=f(x0+h/2,y0+m1*h/2);     float m3=f(x0+h/2,y0+m2*h/2);     float m4=f(x0+h,y0+m3*h);     float m=(m1+2*m2+2*m3+m4)/6;     yn=y0+m*h;     //for next iteration         x0=x0+h;     y0=yn;   }while(x0<xn); printf("\n\nHence, y(%0.1f)=%0.4f",xn,yn); getch(); }

C Program for Gauss Elimination Method

C Program for Gauss Elimination Method #include<stdio.h> #include<conio.h> void main() {   int i,j,k,n;   float A[20][20],c,x[10],sum;   printf("\nEnter the order of matrix: ");   scanf("%d",&n);   printf("\nEnter the elements of augmented matrix row-wise:\n\n");   for(i=1; i<=n; i++)   {     for(j=1; j<=(n+1); j++)     {       printf("A[%d][%d] : ", i,j);       scanf("%f",&A[i][j]);     }   }   /* loop for the generation of upper triangular matrix*/   for(i=1; i<=n; i++)   {     for(j=1; j<=n; j++)     {       if(j>i)       {         c=A[j][i]/A[i][i];         for(k=1; k<=n+1; k++)         {           A[j][k]=A[j][k]-c*A[i][k];         }       }     }   }   /* Upper Traingular matrix */   printf("\nThe Upper Triangular matrix is: \n\n");   for(i=1; i<=n; i++)   {     for(j=1; j<=(n+1); j++)     {       printf("%f ",A[i][j]);     }  

C Program for Euler Method

C Program for Euler Method #include <stdio.h> #include <conio.h> float f(float x,float y) {return x*y;} void main() {   float x0,y0,xn,yn,h;   printf("Enter x0, y0 and h: ");   scanf("%f%f%f",&x0,&y0,&h);   printf("Enter xn: ");   scanf("%f",&xn);   do   {     yn=y0+h*f(x0,y0);     x0=x0+h;     y0=yn;   }while(x0<xn);   printf("y(%0.2f) = %0.4f Ans",xn,yn);   getch(); }

C Program for Least Square Method

C Program for Least Square Method (Regression Analysis) #include<stdio.h> #include<conio.h> void main() { float x[100],y[100],sumx=0,sumx2=0,sumy=0,sumyx=0,b,a; int i,n; printf("Enter n: "); scanf("%d",&n); printf("Enter the values:\n"); for(i=0;i<n;i++) { printf("Enter x[%d] and y[%d]: ",i,i); scanf("%f%f",&x[i],&y[i]); } for(i=0;i<n;i++) { sumx=sumx+x[i]; sumx2=sumx2+x[i]*x[i]; sumy=sumy+y[i]; sumyx=sumyx+y[i]*x[i]; } //for y=ax+b b=(sumx2*sumy-sumyx*sumx)/(n*sumx2-sumx*sumx); a=(n*sumyx-sumx*sumy)/(n*sumx2-sumx*sumx); printf("\nHence, the required eqn is y = %fx + %f",a,b); getch(); }

Hacking wifi using cmd

1: WEP: Wired Equivalent Privacy (WEP) is one of the widely used security key in wifi devices. It is also the oldest and most popular key and was added in 1999. WEP uses 128 bit and 256-bit encryption. With the help of this tutorial, you can easily get into 128-bit encryption and Hack WiFi password using CMD. 2: WAP and WAP2: Wi-Fi Protected Access is an another version of WiFi encryption and was first used in 2003. It uses the 256-bit encryption model and is tough to hack. WAP2 is an updated version of WAP and was introduced in 2006. Since then it has replaced WAP and is now been used mostly in offices and colleges worldwide. Steps to Hack Wifi password using cmd: 1: Open command prompt by going to start and click on run command or enter windows+r, then type cmd and hit Enter 2: In command prompt window, type netsh wlan show network mode=bssid hack wifi password using cmd hack wifi password using cmd 3: This command will show all the available WiFi network in your area 4: Thi

C Program for Gauss-Seidel Method

C Program for Gauss-Seidel Method // Given system is: // 20x+y-2z=17 // 3x+20y-z=-18 // 2x-3y+20z=25 #include <stdio.h> #include <conio.h> #include <math.h> float f(float x,float y,float z) {   return ((17-y+2*z)/20); // x=(17-y+2*z)/20 } float s(float x,float y,float z) {   return ((-18+z-3*x)/20); // y=(-18+z-3*x)/20 } float t(float x,float y,float z) {   return ((25-2*x+3*y)/20); // z=(25-2*x+3*y)/20 } void main() {   float x0,y0,z0,x1=0,y1=0,z1=0,tempx,tempy,tempz,acc=0.0001;   int iteration=0;   printf("Enter initial guesses:\n");   scanf("%f%f%f",&x0,&y0,&z0);   do   {     tempx=x1;     tempy=y1;     tempz=z1;     x1=f(x0,y0,z0);     y1=s(x1,y0,z0);     z1=t(x1,y1,z0);     iteration++;     x0=x1;     y0=y1;     z0=z1;   }while(fabs(tempx-x1)>acc && fabs(tempy-y1)>acc && fabs(tempz-z1)>acc);   printf("\n\nFinally,\n");   printf("x=%f Ans\ny=%f Ans\nz

C Program for Gauss-Jacobi Method

C Program for Gauss-Jacobi Method // Given system is: // 20x+y-2z=17 // 3x+20y-z=-18 // 2x-3y+20z=25 #include <stdio.h> #include <conio.h> #include <math.h> float f(float x,float y,float z) {   return ((17-y+2*z)/20); //x=(17-y+2*z)/20 } float s(float x,float y,float z) {   return ((-18+z-3*x)/20); //y=(-18+z-3*x)/20 } float t(float x,float y,float z) {   return ((25-2*x+3*y)/20); //z=(25-2*x+3*y)/20 } void main() {   float x0,y0,z0,x1=0,y1=0,z1=0,tempx,tempy,tempz,acc=0.0001;   int iteration=0;   printf("Enter initial guesses:\n");   scanf("%f%f%f",&x0,&y0,&z0);   do   {     tempx=x1;     tempy=y1;     tempz=z1;     x1=f(x0,y0,z0);     y1=s(x0,y0,z0);     z1=t(x0,y0,z0);     iteration++;     x0=x1;     y0=y1;     z0=z1;   }while(fabs(tempx-x1)>acc && fabs(tempy-y1)>acc && fabs(tempz-z1)>acc);   printf("\n\nFinally,\n");   printf("x=%f Ans\ny=%f Ans\nz=%f

C program for Lagrange Interpolation

Lagrange Interpolation Example #include<stdio.h> #include<conio.h> void main() {   float ax[100],ay[100],x,y=0,temp;   int n,i,j;     printf("Enter n: ");   scanf("%d",&n);   printf("Enter given data...");   for(i=0;i<=n;i++)   {     printf("\nEnter x[%d] and y[%d]: ",i,i);     scanf("%f%f",&ax[i],&ay[i]);   }   printf("Enter x: ");   scanf("%f",&x);   for(i=0;i<=n;i++)   {     temp=1;     for(j=0;j<=n;j++)     {       if(j!=i)       {         temp*=(x-ax[j])/(ax[i]-ax[j]);       }     }     y+=temp*ay[i];   }   printf("Hence, f(%f) = %f",x,y);   getch(); }

CSIT 2nd year 4th semester – DBMS notes (Part I)

CSIT 2nd year 4th semester – DBMS notes (Part I) What do you mean by Data and Database? Data can be divided into three categories. Raw data – this could be “85” – doesn’t have meaning when it stands alone. It might mean something if you knew it was weight of a man in Kilograms. Related raw data is a group (data set or data file) of organized raw data that can be tied together. For example, it could be a group of Names, weights, blood group and identification numbers, all tied to the Identity cards issued to patients at hospitals Cleaned raw data is all the above after being validated or processed through some process. Such a process might ensure that blood groups doesn’t have any value as “red” or “black” for example only allowed values could be of the kind A,A+,B,B+ etc. Data can be acquired from many different sources. It must always be evaluated as to which category it belongs, and if it needs any additional validation before anal