Monthly Archives: June 2014

Write the functions to perform the following : 10m Dec2005

Write the functions to perform the following : 10m Dec2005  To accept a string and print the rightmost “n” characters   #include<stdio.h> #include<string.h> #include<alloc.h> char *rightsub(char *,int n); void main() { char s1[20],s2[20],ch,*s; int n; clrscr(); printf(“enter the string s1:”); gets(s1); printf(“enter the no of characters to extract=”); scanf(“%d”,&n); s=rightsub(s1,n); printf(“\nright sub string: %s”,s); free(s); getch();… Read More »

Write a program in ‘C’ to find the length of a given string including blank spaces, tabs and other special symbols use “Pointers” concept. 10m Dec2005

Write a program in ‘C’ to find the length of a given string including blank spaces, tabs and other special symbols (new line character should be taken as a string terminating character) Note : You should use “Pointers” concept. 10m Dec2005   Use while(str[i] != “\n”)  instead of while(*str)   Solved program can be found… Read More »

Design an algorithm and draw corresponding flowchart to convert a decimal number to its hexadecimal equivalent. 10m Dec2005

Design an algorithm and draw corresponding flowchart to convert a decimal number to its hexadecimal equivalent. 10m Dec2005 An algorithm is a finite set of steps defining the solution of a particular problem. An algorithm is expressed in pseudo code – something resembling C language or Pascal, but with some statements in English rather than… Read More »

Write a symbolic constant or a macro definition for each of the following : 9m Dec2005

 Write a symbolic constant or a macro definition for each of the following : 9m Dec2005 (i) Define a macro called AREA, which will calculate area of circle in terms of radius. Use the constant PI in calculation. # include<stdio.h> # define PI 3.142857 # define AREA(radius) PI * radius * radius main( ) {… Read More »

Write the syntax and explain the purpose of the following function: Fprintf( ) 2m Dec2005

Write the syntax and explain the purpose of the following function: 2m Dec2005   (iii) Fprintf( ) Description The C library function int fprintf(FILE *stream, const char *format, …) sends formatted output to a stream. Declaration Following is the declaration for fprintf() function. [codesyntax lang=”c”] int fprintf(FILE *stream, const char *format, …) [/codesyntax]Parameters stream — This… Read More »

Write the syntax and explain the purpose of the following functions : Fclose() 2m Dec2005

Write the syntax and explain the purpose of the following functions : 2m Dec2005 (ii) Fclose( ) Description The C library function int fclose(FILE *stream) closes the stream. All buffers are flushed. Declaration Following is the declaration for fclose() function. [codesyntax lang=”c”] int fclose(FILE *stream) [/codesyntax]Parameters stream — This is the pointer to a FILE… Read More »

Write the syntax and explain the purpose of the following functions : Fseek() 2m Dec2005

Write the syntax and explain the purpose of the following functions : 2m Dec2005 (i) Fseek( ) Description The C library function int fseek(FILE *stream, long int offset, int whence) sets the file position of the stream to the given offset. Declaration Following is the declaration for fseek() function. [codesyntax lang=”c”] int fseek(FILE *stream, long… Read More »

Write the functions to perform the following : 10m Dec2005

Write the functions to perform the following : 10m Dec2005   (i) To find mn where m, n > 0 #include<stdio.h> void main() {  long int power(int,int);  int M,N;  long int RES;  printf(“ENTER M : “);  scanf(“%d”,&M);  printf(“ENTER N : “);  scanf(“%d”,&N);  RES=power(M,N);  printf(“\nRESULT IS %ld “,RES);  getch(); } long int power(int M,int N) {  long… Read More »

Explain the important features of ‘C’ language. Mention the types of applications which can be developed using C. List any three ‘C’ compilers. 10m Dec2005

Explain the important features of ‘C’ language. Mention the types of applications which can be developed using C. List any three ‘C’ compilers. 10m Dec2005  Features of ‘C’ language:- C is a general purpose, structured programming language. C programming is widely used in computer Technology.  ·         Low Level Features: C programming provides Low level features… Read More »

Write a program in ‘C’ to add the given number of days to the current date and print the (final) resultant date. (for e.g. adding 12 days to 22/08/2005 will result in 03/09/2005) 10m Dec2005

Write a program in ‘C’ to add the given number of days to the current date and print the (final) resultant date. (for e.g. adding 12 days to 22/08/2005 will result in 03/09/2005)  10m Dec2005     #include <time.h> #include <stdio.h> void  main() { struct tm date = {0} ; time_t timer; clrscr(); timer=time(NULL); date =… Read More »