# UP Board Solutions for Class 10 Computer Science Chapter 10 String Data Manipulation

यहां हमने यूपी बोर्ड कक्षा 10वीं की कंप्यूटर विज्ञान एनसीईआरटी सॉल्यूशंस को दिया हैं। यह solutions स्टूडेंट के परीक्षा में बहुत सहायक होंगे | Student up board solutions for Class 10 Computer Science Chapter 10 String Data Manipulation pdf Download करे| up board solutions for Class 10 Computer Science Chapter 10 String Data Manipulation notes will help you. NCERT Solutions for Class 10 Computer Science Chapter 10 String Data Manipulation pdf download, up board solutions for Class 10 computer science.

String Data Manipulation Long Answer Type Questions (8 Marks)

Question 1.
What do you know about string function? Explain three-string functions with suitable examples.
Or
What is a string? Explain two string functions of your choice. (UP 2007, 08, 11, 12, 13)
String Functions. String functions are those functions which handle string data. ‘C’ language uses a large set of useful string handling library functions. Three string functions are:

1. STRCPY( ): This function copies the contents of one string into another. The base addresses of the source and target strings should be supplied to this function.
Example:

```void main()
{
char src[ ] = “Rajeev”;
char tgt;
strcpy (tgt, src);
printf (“Source string = %s”, src);
printf (“Target string = %s”, tgt);
}
Output:
Source string = Rajeev
Target string = Rajeev```

2. STRLWR(): This function converts upper case (A to Z) string to all lower case (a to z).
Example:

```void main()
{
char STR[ ] = “RAJEEV”;
printf (“Upper case = %s”, STR);
strlwr(STR);
printf(“lower case = %s”, STR);
}
Output:
Upper case = RAJEEV
Lower case = rajeev```

3. STRUPR( ): This function converts lower case (a to z) string to upper case (A to Z) string:
Example:

```void main()
{
char str[ ] = “rajeev”;
prinft (“lower case = %S”, str);
strupr (str);
printf (“upper case = %S”, str);
}```

Output:
Lower case = rajeev
Upper case = RAJEEV

Question 2.
Explain GETS() and PUTS() function with example.
GETS( ): In ‘C’ scanf( ) is not capable of receiving a multiword string, therefore, names such as “Rajeev Sharma” would be unacceptable. The function collects a string of characters terminated by a new line, the standard input.
PUTS(): The function puts() can display only one string at a time. Puts copies the null-terminated string to the standard output. Also on display a string, unlike printf(), puts() places the cursor on the next line.
Example:

```void main()
{
char name ;
gets (name);
puts (“Good Morning !”);
puts (name);
}```

Output:
Good Morning
Rajeev Sharma.

Question 3.
What is concatenation? Explain with example.
Or
Explain the mechanism of Concatenation of a new word in a string. (UP 2017)
Concatenation: Concatenation means joining of two different strings to form one string. In ‘C’, streat function is used to do concatenation.
STRCAT(): This function appends or concatenates the source string at the end of the target string. For example, “Rajeev” and “Sharma” on concatenation would result in a string “Rajeev Sharma”. The length of the resulting string is strlen(dest) + strlen(src).
Example:

```void main()
{
char src[ ] = “Rajeev”;
char tgt[ ] = “Sharma”;
strcat (tgt, src);
printf (“n source string = % s”, src);
printf (“n target string = % s”, tgt);
}```

Output:
source string = Rajeev
target string = Sharma Rajeev.

Question 4.
WAP to check for palindrome.
Program:

```#include<stdio.h>
#include<conio.h>
void main()
{
char str[20);
char temp;
puts (“Enter any word”);
gets (str);
strcpy (temp, str);
strrev (str);
if (strcmp (str, temp) == 0)
{
printf (“it is a palindrome”);
}
else
{
printf (“it is not a palindrome”);
}
}```

Question 5.
WAP to change a string from lower case to upper case.
Program:

```#include<stdio.h>
#include<conio.h>
#include void main()
{
char str ;
puts (“enter a string in lower case”);
gets (str);
strupr (str);
printf (“upper case = %S”, str);
}```

String Data Manipulation Short Answer Type Questions (4 Marks)

Question 1.
What is strlen in ‘C’ language? (UP 2011)
STRLEN( ): This function calculates the length of a string. It returns the number of characters in a string, not counting the terminating null character. Its syntax is illustrated in the following program:

```void main()
{
char N[ ] = “This is a book”;
int len;
len = strlen(N);
printf (“The length of the string is %d”, len);
}```

Question 2.
What are the strings? (UP 2008, 18)
Strings: Like a group of integers can be stored in an integer array, similarly a group of characters can be stored in a character array. Strings are single-dimensional arrays of type char. In ‘C’, a string is terminated by null character or ‘’. String constants are written in double-quotes.
For Example: **char name [ ] = {‘I’, ‘N’, ‘D’, ‘T’, ‘A’ , ‘’};
Each character in the array occupies one byte of memory and the last character is always ‘’.’′ is called null character. Note that ‘’ and ‘0’ are not the same. ASCII value of ‘’ is 0, whereas the ASCII value of ‘O’ is 48. Many string functions such as string length, string compare, string copy, string concatenate etc. are most commonly used functions.

Question 3.
What is the purpose of strcmp function?
Strcmp function. This function compares two strings to find out whether they are the same or different. The string comparison starts with the first character in each string and continues with subsequent characters until the corresponding characters differ or until the end of the strings is reached. If the two strings are identical, strcmp () returns a value zero. If they are not, it returns the numeric difference between the ASCII values of the non-matching characters.
Example:

```void main ()
{
char str 1 [ ] = “Rajeev”;
char str 2 [ ] = “Sharma”;
int i, j, k;
i = strcmp(str l, “Rajeev”);
j = strcmp (str l, str 2);
k = strcmp (str l, “Rajeev Sharma”);
printf (“n % d %d % d”, i, j, k);
}```

Output:
0 – 1 – 32

String Data Manipulation Very Short Answer Type Questions (2 Marks)

Question 1.
Which function is used to find the length of a string?
strlen() function.

Question 2.
What is the name of the function which is used to copy a string into another?
strcpy () function.

Question 3.
In ‘C’ language a string is terminated with what?
In ‘C’ language a string is terminated by null character or ‘10’.

Question 4.
What is the ASCII value of ‘10’ and ‘0’?
ASCII value of ‘10’ is 0. ASCII value of ‘0’ is 48.

Question 5.
The process of appending one string at the end of smother string is known as ………..
Concatenation.

Question 6.
Function to check the time of the day. (UP 2012)
time ( ).

String Data Manipulation Objective Type Questions (1 Mark)

There are four alternative answers for each part of the questions. Select the correct one and write in your answer book:

Question 1.
(a) An alphabet
(b) A number
(c) \$ symbol
(d) # sign
(a) An alphabet

Question 2.
% is used for:
(a) String data type
(b) Character data type
(c) Numeric data type
(d) Float data type.
(a) String data type

Question 3.
Which header file is used for sesmf () and print ()?
(a) stdio.h
(b) conio.h
(d) math.h
(d) Both (a) and (b).
(b) conio.h

Question 4.
Which of the following is not a looping statement?
(a) for
(b) if
(c) while
(d) do-while.
(b) if

————————————————————

All Chapter UP Board Solutions For Class 10 computer science

All Subject UP Board Solutions For Class 10 Hindi Medium

Remark:

हम उम्मीद रखते है कि यह UP Board Class 10 computer science NCERT Solutions in Hindi आपकी स्टडी में उपयोगी साबित हुए होंगे | अगर आप लोगो को इससे रिलेटेड कोई भी किसी भी प्रकार का डॉउट हो तो कमेंट बॉक्स में कमेंट करके पूंछ सकते है |

यदि इन नोट्स से आपको हेल्प मिली हो तो आप इन्हे अपने Classmates & Friends के साथ शेयर कर सकते है और HindiLearning.in को सोशल मीडिया में शेयर कर सकते है, जिससे हमारा मोटिवेशन बढ़ेगा और हम आप लोगो के लिए ऐसे ही और मैटेरियल अपलोड कर पाएंगे |

आपके भविष्य के लिए शुभकामनाएं!!