Tag Archives: find

Write a macro to find the smallest number among 3 given numbers. 7m Jun2007

Write a macro to find the smallest number among 3 given numbers. 7m Jun2007 Code: #include<stdio.h> #define MIN(X,Y)(X<Y ? X:Y) #define SMALL(X,Y,Z)(MIN(X,Y)<Z ? MIN(X,Y):Z) void main() { int FIRST,SECOND,THIRD; clrscr(); printf(“ENTER NUMBERS TO COMPARE\n”); printf(“\nFIRST NUMBER : “); scanf(“%d”, &FIRST); printf(“\nSECOND NUMBER : “); scanf(“%d”, &SECOND); printf(“\nTHIRD NUMBER : “); scanf(“%d”, &THIRD); printf(“\nThe SMALLER NUMBER IS… Read More »

Find the average access time for the disk. 4m Dec2007

Seek time on a hard disk is 50 ms. it rotates at a speed of 3000 rotations/sec. Each track on the disk has 100 sectors. Find the average access time for the disk. 4m Dec2007 Disk Rotation Speed = 3000 rps.  (i.e. 180000 rpm) Sectors per Track = 100 sectors Seek time = 50 millisecond  … Read More »

Write an algorithm and draw flowchart to find whether a given string S1 is substring of another string S2. 10m Dec2007

Write an algorithm and draw flowchart to find whether a given string S1 is substring of another string S2. 10m Dec2007   Algorithm Step 1: Input String and Substring (Note: Substring should be smaller than String) Step 2: Find Length of String (Len1) and Find Length of Substring (Len2) Step 3: flag <- 0 Step… Read More »

Find out the errors, if any, in the following 5m Dec2005

Find out the errors, if any, in the following, and               5m Dec2005 (i)                 CMP AX, BX No error since two register operand are allowed for comparison in the permutations shown below. (ii)               IDlV AX, CH IDIV works or allows one parameter only and it can either be register or memory only as shown below. corrected… Read More »

Write a 8086 assembly language program to find whether two strings are of equal length. 5m Dec2005

Write a program in 8086 assembly language to find whether two strings are of equal length. You can assume that the strings are stored in the main memory and a string is terminated by a $ character 5m Dec2005 DATA SEGMENT STR1 DB ‘GANGADHAR$’ STR2 DB ‘KOPELLA$’ MSG1 DB 10,13,’LENGTH OF THE STRING 1 IS… Read More »

An Assembly language program to find substring in given string – IGNOU MCA Assignment 2014-15

BACHELOR OF COMPUTER APPLICATIONS Course Code : BCSL-022 Course Title : Assembly Language Programming Lab Assignment Number : BCA(II)/BCSL022/Assign/14-15 Maximum Marks : 50 Weightage : 25%   Write and run an Assembly language program that finds the occurrence of a given substring, for example, BCS in a given string, for example, AXYBCSDEF (please note that in… Read More »

An Assembly Language program to find minimal and maximal elements – IGNOU MCA Assignment 2014 – 15

 MASTER OF COMPUTER APPLICATIONS Course Code : MCSL-017 Course Title : C and Assembly Language Programming Assignment Number : MCA(1)/L017/Assign/2014-15 Maximum Marks : 100 Weightage : 25%   Develop and execute an assembly language program to read an array of numbers and find the minimal and maximal elements.    DATA SEGMENT ARR DB 5,3,7,1,9,2,6,8,4 LEN… Read More »

Write a macro to find the sum of n numbers. 7m Jun2007

Write a macro to find the sum of n numbers. 7m Jun2007 Code: #include<stdio.h> # define SUM(n) ( (n * (n+1)) / 2 ) void main() { int num; clrscr(); printf(” Enter number : “); scanf(“%d”,&num); printf(“\n Sum of n numbers : %d “,SUM(num)); getch(); } [codesyntax lang=”c”] c#include<stdio.h> # define SUM(n) ( (n *… Read More »

Write a recursive program in ‘C’ to find the L.C.M. (Least Common Multiple) of two given numbers. 10m Dec2006

Write a recursive program in ‘C’ to find the L.C.M. (Least Common Multiple) of two given numbers. 10m Dec2006 #include<stdio.h> int lcm(int,int); void main() { int NUM1,NUM2,LCM; clrscr(); printf(“ENTER ANY TWO POSITIVE NUMBERS TO FIND ITS L.C.M. : “); scanf(“%d%d”,&NUM1,&NUM2); if(NUM1>NUM2) LCM = lcm(NUM1,NUM2); else LCM = lcm(NUM2,NUM1); printf(“LCM OF TWO NUMBERS IS %d”,LCM); getch();… Read More »

What is the difference between a function and a macro? Find the largest number among two numbers using a function definition as well as a macro. Which is more efficient in terms of execution time and code size? 10m Jun2006

What is the difference between a function and a macro? Find the largest number among two numbers using a function definition as well as a macro. Which is more efficient in terms of execution time and code size? 10m Jun2006  Difference between a function and a macro:    Function Code [codesyntax lang=”c”] int MAX(X,Y) {… Read More »