Category: even semester
Database 2018 (Make up)
Group A 1. What is the advantage of Database Management System over File Management System?  The advantage of Data Management System over File Management System are: i. Data independence ii. Data integrity and security iii. Efficient data access 2. What is data independence?  Data independence is an ability to modify a schema definition […]
Continue ReadingDCCN 2017 Solution
2018 1.Why there is bandwidth wastage in FDM? 2018 Ans: Due to the use of guard band in FDM, there is a bandwidth wastage as it uses the bandwidth of FDM. 2.Which layer is responsible for name recognition and security? 2018 Ans: For name recognition and security application layer and presentation layer are responsible […]
Continue ReadingDCCN 2015 Solution
1.How LAN is different form WAN.2015 2015Â (8)
Continue ReadingDCCN 2013 Solution
2013 (2 B)
Continue ReadingC programming 2012
Year 2012 Q.No 3 a)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#include<stdio.h> #include<stdlib.h> int main() { float *p; int n,i; float g; printf("How many float number you want to enter? "); scanf("%d",&n); p=(float*)malloc(n*sizeof(float)); printf("Enter %d float numbers ",n); for(i=0;i<n;i++) scanf("%f",&p[i]); for(i=0;i<n-1;i++) { if(p[i]>p[i+1]) { g=p[i]; } else { g=p[i+1]; } } printf("greatest number is %f",g); return 0; } |
b)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#include<stdio.h> #include<stdlib.h> int main() { float *num; int n,i,j; float a; printf("How many float number you want to enter? "); scanf("%d",&n); num=(float*)malloc(n*sizeof(float)); printf("Enter %d float numbers ",n); for(i=0;i<n;i++) scanf("%f",&num[i]); for (i = 0; i < n; ++i) { for (j = i + 1; j < n; ++j) { if (num[i] < num[j]) { a = num[i]; num[i] = num[j]; num[j] = a; } } } printf("Displaying in descending order\n"); for(i=0;i<n;i++) { printf("%f\n",num[i]); } return 0; } |
Q.No 3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#include<stdio.h> #include<stdlib.h> int main() { float *num; FILE *fp; int n,i,j; float a,sum,avg; printf("How many float number you want to enter? "); scanf("%d",&n); num=(float*)malloc(n*sizeof(float)); printf("Enter %d float numbers ",n); for(i=0;i<n;i++) scanf("%f",&num[i]); fp=fopen("data.tu","w"); for(i=0;i<n;i++) { sum=sum+num[i]; } avg=sum/n; fprintf(fp,"Sum = %f\n",sum); fprintf(fp,"Avg = %f\n",avg); fclose(fp); return 0; } |
Q.No 4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#include<stdio.h> int main() { int i,j; for(i=1;i<=5;i++) { printf("\n"); for(j=1;j<=5;j++) { if(i<=j) printf("%c",'c'); else printf(" "); printf(" "); } } return 0; } |
Q.No .5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#include<stdio.h> int main() { int a[15],i,sum=0; float b; printf("Enter 15 integers"); for(i=0;i<15;i++) scanf("%d",&a[i]); for(i=0;i<15;i++) { sum=sum+a[i]; } b=sum/15; printf("Average %f",b); return 0; } |
Q.No 6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
#include<stdio.h> struct cattle { int cid; char name[20]; int age; float weight; }; int main() { struct cattle a[28]; int i,sum=0; double avg; for(i=0;i<28;i++) { printf("%d record is\n ",i+1); printf("Enter id "); scanf("%d",&a[i].cid); printf("Enter name "); scanf("%s",a[i].name); printf("Enter age "); scanf("%d",&a[i].age); printf("Enter weight "); scanf("%f",&a[i].weight); } for(i=0;i<28;i++) sum=sum+a[i].weight; avg=sum/28; printf("Avg = %f",avg); return 0; } |
C programming 2013
2013 Q.no 3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
#include<stdio.h> int min(int a[],int n) //Returns minimum element in array { int i,minn=a[0]; for(i=0;i<n;i++) { if(a[i]<minn) minn=a[i]; } return minn; } int max(int a[],int n) //Returns maximum element in array { int i,maxx=a[0]; for(i=0;i<n;i++) { if(a[i]>maxx) maxx=a[i]; } return maxx; } void main() { int n,i,a[n],j,count=0,min_element,max_element,pov=0,neg=0,cou=0,small; printf("Enter how many number to enter "); scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } small=min(a,n); Printf("smallest number is %d",small); min_element=min(a,n); max_element=max(a,n); for(i=min_element;i<max_element;i++) //Run loop from min element to max element { //and get count of each element in array as usual. count=0; for(j=0;j<n;j++) { if(a[j]==i) count++; } if(count) printf("Count of %d is %d\n",i,count); } for(i=0;i<n;i++) { if(i<0) { neg=neg+a[i]; cou++; } else { pov=pov+a[i]; } } printf("Sum of positive number = %d\nSum of negative number = %d\n",pov,neg); for(i=0;i<n;i++) { if(a[i]%2==0) { cou++; } } printf("Total no of even elements = %d",cou); } |
Q.no. 4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#include<stdio.h> #include<string.h> int main() { int n,i; int id[n]; char name[n][20],oname[n][20],occ[n][20]; printf("Enter number of input to be entered"); scanf("%d",&n); for(i=0;i<n;i++) { printf("Enter id "); scanf("%d",&id[i]); printf("Enter name "); scanf("%s",name[i]); printf("Enter office name "); scanf("%s",oname[i]); printf("Enter occupation "); gets(occ[i]); } for(i=0;i<n;i++) { if(strcmp(oname[i],"Nepal Bank")==0 && strcmp(occ[i],"manager")==0) printf("%s\t %d\t %s\t %s\t",name[i],id[i],oname[i],occ[i]); } } |
Q.no 5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
#include<stdio.h> int min(int a[],int n) //Returns minimum rainfall month { int i,minn=a[0]; for(i=0;i<n;i++) { if(a[i]<minn) minn=i; } return minn; } int max(int a[],int n) //Returns maximum rainfall month { int i,maxx=a[0]; for(i=0;i<n;i++) { if(a[i]>maxx) maxx=i; } return maxx; } void result(int a) { switch(a) { case 1: printf("Baisakh\n"); break; case 2: printf("Jestha\n"); break; case 3: printf("Ashad\n"); break; case 4: printf("Shrawan\n"); break; case 5: printf("Bhadoh\n"); break; case 6: printf("Ashosh\n"); break; case 7: printf("Kartik\n"); break; case 8: printf("mangsir\n"); break; case 9: printf("poush\n"); break; case 10: printf("magh\n"); break; case 11: printf("falgun\n"); break; case 12: printf("chaitra\n"); } } void main() { int n[12],i,total; float avg; for(i=0;i<12;i++) { printf("Enter total no of rainfall for %d month\n",i+1); scanf("%d",&n[i]); total=total+n[i]; } avg=total/12; printf("Average = %f\n",avg); for(i=0;i<12;i++) { if(max(n,12)==i) { printf("month with highest rainfall is "); result(i+1); } if(min(n,12)==i) { printf("Month with lowest rainfall is "); result(i); } } } |
C programming 2014
year 2014 Q.no 3 Write function that display the factorial of 7 only.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#include<stdio.h> void fact(int n) { int fact = 1; if(n==7) { for(int i=1;i<=n;i++) fact*=i; printf("The factorial of 7 is: %d.",fact); } else printf("This function gives the factorial of the number 7 only"); } void main() { fact(7); } Output: The factorial of 7 is: 5040. |
Q.no 4 Write program that takes string as input from the user, and then display the length.
1 2 3 4 5 6 7 8 9 |
#include<stdio.h> #include<string.h> void main() { char srt[50]; printf("Enter a string:\n"); gets(str); printf("The length of string is %d.",strlen(srt)); } |
Q.no 5 Write a program to display the following pattern. * # * # * ? ? * ? ? +
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#include<stdio.h> void main() { int i; for(i=0;i<4;i++) { printf("*\t"); if(i<2) printf("#"); if(i==2) printf("?\t?"); if(i==3) printf("?\t?\t+"); printf("\n"); } } |
Group […]
Continue Readingc programming 2015
Year 2015 Q.No. 2 Write function that takes list of integers of size 10 as parameter and display all the prime numbers of the list.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
#include<stdio.h> void chk(int a[]) { printf("Prime numbers:\n"); int c; for(int i=0;i<10;i++) { c=0; for(int j=2;j=a[i]/2;j++) { if(a[i]%j==0) { c=1; break; } } if(c==0) printf("%d\n",a[i]); } } void main() { int a[10]; printf("Enter 10 numbers: "); for(int i=0;i,<10;i++) scanf("%d",a[i]); chk(a); } Output: Enter 10 numbers: 5 6 7 8 9 10 11 1 2 3 Prime numbers: 5 7 11 1 2 3<input id="2029.6740362804351" class="cdbx-try-code cdbx-btn-main" style="background-color: #ffffff; margin-bottom: 0; color: #008b8b; border: 1px solid rgba(231, 231, 230, 1); border-radius: 10px; font-size: 13px; height: 30px; min-width: 60px; max-width: 150px; padding: 4px; font-weight: normal; outline: none; display: none; float: right;" type="button" value="Run" data-code="1534082630476.9202" data-highlight="" data-lang="0" data-filename="Filename" /> |
Q.no 3 Write a program that displays the line “Best of Luck” 5 times, using a function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#include<stdio.h> void dis() { for(int i=0;i<5;i++) printf("Best of Luck\n"); } void main() { dis(); } Output: Best of Luck Best of Luck Best of Luck Best of Luck Best of Luck |
Q.No. 5 Write a program to read a line of text, […]
Continue Reading