Tag: BIM Notes
DCCN 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 ReadingC programming 2016
2016 2. Display the following pattern using loop. a. BBA b. BIM c. BIM d. BBA e. BBA f. BIM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#include<stdio.h> void main() { int i; char c='a'; for(i=1;i<=6;i++) { if(i==1||i==4||i==5) printf("%c. BBA\n",c); else printf("%c. BIM\n",c); c++; } } |
3. Write a program to count white spaces in a given sentence.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#include<stdio.h> #include<string.h> void main() { char s[100]; int i=0,c=0,l=0; printf("Enter a string:\n"); gets(s); while(s[i]!='\0') { l++; i++; } for(i=0;i<l;i++) { if(s[i]==' ') c++; } printf("Total number of white spaces in the given sentence is: %d.",c); } Output: Enter a string: Hello My Name is Total number of white spaces in the given sentence is: 3. |
4. Write a program to calculate the sum of the following numbers: -3, -4, 8, 9, 10, -17.
1 2 3 4 5 6 7 8 9 10 |
#include<stdio.h> void main() { int a[6]={(-3),(-4),8,9,10,(-17)}; int i,sum=0; for(i=0;i<6;i++) { sum+=a[i]; } printf("The sum of (-3,-4,8,9,10,-17) is %d",sum); } |
5. Write […]
Continue Readingc programming 2018 Makeup
Year 2018 Makeup Write a program to print transpose of a given matrix.
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 |
#include<stdio.h> void main() { int r,c; printf("Enter the size of the matrix: "); scanf("%d%d",&r,&c); int a[r][c], t[c][r]; int i,j; printf("Enter the elements of the matrix:\n"); //Inputting the elements of the matrix for( i = 0 ; i < r ; i++ ) { for( j = 0 ; j < c ; j++) { printf("Enter [%d][%d] element: ",i,j); scanf("%d",&a[i][j]); } } printf("Given matrix:\n"); //Displaying the elements of the matrix for( i = 0 ; i < r ; i++ ) { for( j = 0 ; j < c ; j++) printf("\t%d",a[i][j]); printf("\n"); } //Calculating transpose of the matrix for( i = 0 ; i < c ; i++ ) for( j = 0 ; j < r ; j++) t[i][j] = a[j][i]; printf("Transpose of the given matrix:\n"); //Displaying the elements of the transpose matrix for( i = 0 ; i < c ; i++ ) { for( j = 0 ; j < r ; j++) printf("\t%d",t[i][j]); printf("\n"); } } |
Write a C program to read the file “hello.txt” and count the number of characters written in this file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#include<stdio.h> void main() { FILE *f = fopen("hello.txt","r"); int count = 0; if(f) { int c; while((c=fgetc(f))!=EOF) count++; printf("Number of characters in the file 'hello.txt': %d.",count); } else printf("Error reading the file 'hello.txt'."); fclose(f); } |
Write a function to calculate the factorial value of the given number.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#include<stdio.h> int fact(int n) { if(n<2) return 1; return n*fact(n-1); } void main() { int n; printf("Enter a number: "); scanf("%d",&n); printf("Factorial of %d is %d.",n,fact(n)); } |
Write a program to read n […]
Continue Reading