Tag Archives: C

Write a Program in ‘C’ to copy one file to another. The program should read the filenames at command line. 10m Jun2009

Write a Program in ‘C’ to copy one file to another. The program should read the filenames at command line. 10m Jun2009 Code: #include<stdio.h> int main(int argc,char *argv[]) { FILE *fs,*ft; int ch; if(argc!=3) { printf(“Invalide numbers of arguments.”); return 1; } fs=fopen(argv[1],”r”); if(fs==NULL) { printf(“Can’t find the source file.”); return 1; } ft=fopen(argv[2],”w”); if(ft==NULL)… Read More »

Write a Program in ‘C’ to print the following output ‘n’ rows. 10m june2009

Write a Program in ‘C’ to print the following output ‘n’ rows. For example, if n=3, the following should be output by the program: 10m june2009   #include <stdio.h> void main() { int I,J,N=3,K=0,ODD=1,SPACE; clrscr(); SPACE=N; for(I=1;I<=N;I++) { for(J=1;J<SPACE;J++) { printf(” “); } K=0; for(J=1;J<=ODD;J++) { if(J<=I) { K++; } else { K–; } printf(“%d… Read More »

Write a program in ‘C’ to check whether the given year is leap or not. Also explain the logic of the program. 8m Dec2008

Write a program in ‘C’ to check whether the given year is leap or not. Also explain the logic of the program. 8m Dec2008 The leap year formula is: A leap year is divisable by 4, but not by 100 (except if divisable by 400.)   #include<stdio.h> void main(){ int year; clrscr(); printf(“Enter any year:… Read More »

When can two matrices of order m x n and p x q be multiptied? Also write a program in ‘C’ to multiply two such matrices. 10m Dec2008

When can two matrices of order m x n and p x q be multiptied? Also write a program in ‘C’ to multiply two such matrices. 10m Dec2008   The only condition which makes matrix multiplication possible is n should be equal to p (i.e. n==p) n of m x n Matrix and p of… Read More »

Write an Algorithm and a Program that accepts a Binary Tree as input and checks whether it is a Height Balanced Tree – IGNOU BCA Assignment 2015 – 16

BACHELOR OF COMPUTER APPLICATIONS Course Code : BCSL-033 Course Title : Data and File Structures Lab Assignment Number : BCA(III)/L-033/Assignment/2015 Maximum Marks : 50 Weightage : 25% Write an Algorithm and a Program that accepts a Binary Tree as input and checks whether it is a Height Balanced Tree. #include <stdio.h> #include <stdlib.h> struct tnode… Read More »

Write a program in C language that will accept a Graph as input and will generate its Minimum Cost Spanning Tree – IGNOU MCA Assignment 2015 – 16

MASTER OF COMPUTER APPLICATIONS Course Code : MCSL-025 Course Title : Lab Course Assignment Number : MCA(II)/L-025/Assignment/15-16 Maximum Marks : 50 Weightage : 25%   Write a program in C language that will accept a Graph as input and will generate its Minimum Cost Spanning Tree. #include <stdio.h> #define MAXVERTICES 10 #define MAXEDGES 20 typedef… Read More »

Write a program in C language for addition of two numbers which have at least 20 digits each – IGNOU MCA Assignment 2015 – 16

MASTER OF COMPUTER APPLICATIONS Course Code : MCSL-025 Course Title : Lab Course Assignment Number : MCA(II)/L-025/Assignment/15-16 Maximum Marks : 50 Weightage : 25% Write a program in C language for addition of two numbers which have at least 20 digits each.   #include<stdio.h> void main() { int I,J,NUM1[20],NUM2[20],RES[21]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; char N1[21],N2[21];/*getchar is excepts NewLIne charter… Read More »

Simplify the following Boolean function in SOP form using K-Map: F (A, B, C, D) = Σ ( 0,1, 2, 4, 6, 8, 9, 12, 14, 15 ). Draw logic circuit diagram. 8m Jun2008

Simplify the following Boolean function in SOP form using K-Map: F (A, B, C, D) = Σ ( 0,1, 2, 4, 6, 8, 9, 12, 14, 15 ). Also, draw the simplified logic circuit diagram. 8m Jun2008  K-Map for F is: Thus, the simplified equations for F (A, B, C, D) = Σ (0,1, 2, 4, 6,… Read More »

Write a program and flowchart to display the following pattern: 6m Jun2008

Write a program and flowchart to display the following pattern: 6m Jun2008 1 2 3 4 5 6 7 8 9 1 0 11 12 13 14 15 16 17 18 19 20 21   Code: #include<stdio.h> void main() { int I,J,C=1; clrscr(); printf(“Result :\n”); for(I=0;I<6;I++) { printf(“\n”); for(J=0;J<=I;J++) { printf(“%d “,C++); } printf(“\n”); }… Read More »

Give a brief note on null pointer assignment. Write a program to illustrate this concept. 6m Jun2008

Give a brief note on null pointer assignment. Write a program in ‘C’ to illustrate this concept. 6m Jun2008 Null Pointer Assignment It does make sense to assign an integer value to a pointer variable. An exception is an assignment of 0, which is sometimes used to indicate some special condition. A macro is used… Read More »