Tag Archives: string

An Assembly program to convert lower case to upper case – 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%   Write a program in assembly language for converting lower case to upper case in a given string of characters.   DATA SEGMENT MSG1 DB 10,13,’ENTER ANY STRING… Read More »

Using pointers, write a program in ‘C’ to count the occurrence of each character in a given string. 10m Dec2006

Using pointers, write a program in ‘C’ to count the occurrence of each character in a given string. 10m Dec2006   #include <stdio.h> #include <string.h> void main() { char string[100],*ptr; int c=0,count[26]={0}; clrscr(); printf(“Enter a string\n”); gets(string); ptr=string[0]; while (*ptr) { /* Consider characters from ‘a’ to ‘z’ only */ if ( ptr >= ‘a’… Read More »

Write a program that does not use the inbuilt string functions to perform the following: 10m Jun2006

Write a program that does not use the inbuilt string functions to perform the following: 10m Jun2006 (i) To compare two strings [codesyntax lang=”c”] #include<stdio.h> void main() { int str_cmp(char*,char*); char Str1[50],Str2[50]; int val; clrscr(); printf(“\nENTER FIRST STRING TO COMPARE : “); scanf(“%s”,&Str1); printf(“\nENTER SECOND STRING TO COMPARE : “); scanf(“%s”,&Str2); val=str_cmp(Str1,Str2); if(val==0) printf(“\nSTR1 IS… Read More »

Summarize the purpose of the format strings (like %s, %d, %c) that are’ commonly used within the printf function, with an example for each.10m Jun2006

Summarize the purpose of the format strings (like %s, %d, %c) that are’ commonly used within the printf function, with an example for each.10m Jun2006 If printf function format includes format specifiers (subsequences beginning with %), the additional arguments following format are formatted and inserted in the resulting string replacing their respective specifiers. It can… Read More »

Design an algorithm, draw a corresponding flowchart and write a C program to check whether a given string is a palindrome or not. 10m Jun2006

Design an algorithm, draw a corresponding flowchart and write a C program to check whether a given string is a palindrome or not. 10m Jun2006 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… Read More »

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 »

An Assembly Lanuage Program to search for a character in a given string and calculate the number of occurrences of the character in the given string

Now we will write another Assembly Lanuage Program to search for a character in a given string and calculate the number of occurrences of the character in the given string Let’s identify variables needed for this program. First variable will be the one which will hold the Strings entered by user in the variables P1 LABEL BYTE   … Read More »

An Assembly Lanuage Program to determine a given string is a palindrome. If ‘Yes’ output the message “The given string is a palindrome”. If ‘No’ output the message “No, it is not a palindrome”.

Now we will write another Assembly Lanuage Program to determine a given string is a palindrome. If ‘Yes’ output the message “The given string is a palindrome”. If ‘No’ output the message “No, it is not a palindrome”. Let’s identify variables needed for this program. First variables will be the one which will hold the Strings entered… Read More »

An Assembly Lanuage Program, which converts string to its ASCII value and store in array

Now we will write another Assembly Lanuage Program, which converts string to its ASCII value and store in array Let’s identify variables needed for this program. Let’s identify variables needed for this program. First variables will be the one which will hold the Strings entered by user in the variables P1 LABEL BYTE    M1 DB 0FFH    L1… Read More »