Read and download the CBSE Class 12 Computer Science Strings Assignment for the 2025-26 academic session. We have provided comprehensive Class 12 Computer Science school assignments that have important solved questions and answers for Strings. These resources have been carefuly prepared by expert teachers as per the latest NCERT, CBSE, and KVS syllabus guidelines.
Solved Assignment for Class 12 Computer Science Strings
Practicing these Class 12 Computer Science problems daily is must to improve your conceptual understanding and score better marks in school examinations. These printable assignments are a perfect assessment tool for Strings, covering both basic and advanced level questions to help you get more marks in exams.
Strings Class 12 Solved Questions and Answers
Fill ups and Multiple Choice Questions:
Question. What is the length of null string?
Answer: 0 (zero)
Question. Every string must be terminated by __?
Answer: Null Character
Question. Which of the following function is used to reverse the string?
Answer: strrev
Question. Which of the following input function cannot be used to input multiword string?
Answer: scanf()
Question. The function strcmp (“Abcd” ,”ABCD”) will return?
Answer: Negative value
Question. Which of the following function is correct in case of conversion of string digits into their integer value?
a) x =atoi(string)
b) x = stoi(string)
c) x = chartoint(string)
d) all of these
Answer: x =atoi(string)
Question. A string can be stored as an array of ______________
Answer: char
Question. The function strlen(“India is great”) will return the length of string ___________
Answer: 14
Question. __________ function is used to read a complete string.
Answer: gets
Question. _____________ function is used to read a character at a time.
Answer: getchar
Question. How will you declare a string named student with length 50?
Answer: char student[50];
Question. If we consider the string declaration as “char x[10];”, what is the length of the string that can be correctly represented by x?
Answer: 10
Question. If the function strcat(s1,s2) is implemented , then the concatenation will return?
Answer: s2 at the end of s1
Question. Which of the following operation could not be performed on character string with string functions?
a) Combining a string
b) copying a string to another
c) Comparing strings for equality
d) Removing a string
Answer: Removing a string
Question. C does not support the string data type however strings are handled as an array of?
Answer: char
Question. What is missing in this string initialization: char name[8] = {‘r’, ‘a’, ‘e’,‘t’ }?
Answer: \0
Question. To declare and initialized a empty string, a 10 element character array named x, we have char x[10] = “ “ ; What will be the other way for the same?
Answer: char x[10]={‘\0’};
State Whether True or False
Question. A string is represented as array of characters?
Answer: true
Question. strcpy() function is used to copy strings?
Answer: true
Question. To reverse a string, we need two string handling functions strcpy() & strcmp()?
Answer: false
Question. To use string library functions, we have to include header file string.h in our program?
Answer: true
Strings Class 12 Computer Exercise Questions
Question. What is special about the array of char?
Answer: char arrays have special importance in C Language. There is no data type in C to store strings. Therefore, to store string data in, char arrays are being used in C language. To store strings in C, we have to declare char arrays.
For example:
char city[20];
In this example, char array named city has been declared which can store city name with maximum of 20 characters.
Question. What is string?
Answer: String is a combination of one or more characters. It is always enclosed in double quotes. They are terminated by null character (\0) in c. To store strings in c, we use char array. For example: char city[20];
It declares a string variable named city. It can store the string of maximum 20 characters.
Consider another example: char city[20]=”Sunam\0”;
It initializes a string variable named city of length 20 and stores “Sunam” as string value. This value is terminated with null character ‘\0’.
Question. What is the purpose of the null character?
Answer: Null character is also called empty character. It can be represented with the symbol ‘\0’. The length of null character is C is zero. Null character is used to terminate the string in C language. For example: char city[10]= “Sunam\0”;
It declares a string variable named city of length 10 and stores “Sunam” as string value. This value is terminated with null character ‘\0’.
Question. Give the declaration for a string called student, which holds up to 50 characters. Show two ways to initialize the string in the declaration?
Answer: String declaration for student with 50 characters is:
char student[50];
Two methods for declaring strings are:
char student[50]=“Ram\0”;
char student[50]={‘R’, ‘a’, ‘m’,’\0’};
Question. What is the limit of char array?
Answer: Char arrays have a special importance in C language. There is not primitive data type to store string data in c. therefore, to store string values in c, we have to use char arrays. Limit (length) of char array defines the length of string. In c clanguage, maximum length of a string in char array can be 65535. Therefore, we can not extend the limit of char array more than 65535.
Question. What is a difference between “A” and ‘A’?
Answer: “A” is a string while ‘A’ is a character. “A” is string because any string value must be enclosed in double quotes and ‘A’ is char because any char value must be enclosed in single quotes in c language.
Question. Give the difference between putchar() and puts()?
Answer: The difference between putchar() and puts() functions is as follows: puchar() function: This is the unformatted character output function. This function is used to output a single unformatted character on the monitor screen. puts() function: This is the unformatted string output function. This function is used to output an unformatted string on the monitor screen.
Question. List the various functions that can be used to perform the I/O of the string data?
Answer: A string can be read-in or written-out using the input/output functions. Some of the commonly used string input/output functions are explained below:
Reading Strings (String Input Functions):
• scanf() : This function is used to input single word formatted string
• gets() : This function is used to input multiword unformatted string
• getchar() : This function is used to input unformatted single character
Writing Strings (String Output Functions):
• printf() : This function is used to output formatted string
• puts(): This function is used to output unformatted string
• putchar(): This function is used to output unformatted single character
Question. Can we use scanf() to read a string? If no, then give reason. Why it is wrong to use the & symbol when reading in a string with scanf()?
Answer: Yes, we cam use scanf() to read a string. But this function can not be used to inpute multiword strings in C language. There is not data type for storing string data in C. For this, we use char arrays. Name of an array in C represents the address of the first element of array. So, when we use char array in scanf() function, array name itself represents the address of string variable. So, it will be wrong to use the & symbol when reading a string with scanf() function.
Question. What is stored in the str, if each of the following values, separately, is read in using a single call to scanf()? char str[10];
a) cityscape
b) New Delhi
c) one or more blanks
Answer: a) cityscape
b) New
c) one
Question. Explain strlen() function with suitable example.
Answer: Function strlen() stands for string length. This function is used to count the total number of characters in the given string. This function is present in the string.h header file. Therefore, to use this function, we have to include the string.h header file in our program. Following code shows how to use this function:
strlen(“punjab”);
This function returns 6 as string length because the string “Punjab” contains 6 characters.
Question. Explain strrev() function with suitable example.
Answer: Function strrev stands for string reverse. This function is used to reverse the given string value. This function is present in the string.h header file. Therefore, to use this function, we have to include the string.h header file in our program. Following code shows how to use this function:
strrev(“Punjab”);
It reverses the given string to bajnuP.
Question. Explain strcpy() function with suitable example.
Answer: Function strcpy stands for string copy. This function is used to copy a string value into string variable. This function is present in the string.h header file. Therefore, to use this function, we have to include the string.h header file in our program. Following code shows how to use this function.
strcpy(str, “Punjab”);
It copy/store the string value “Punjab” into the string variable str.
Question. Explain strcat() function with suitable example.
Answer: Function strrev stands for string concatenation. This function is used to combines the two strings. It appends 2nd string value at the end of first string value. This function is present in the string.h header file. Therefore, to use this function, we have to include the string.h header file in our program. Following code shows how to use this function. Let the two strings are: char str1[10]=“Sunam”; char str2[10]=“City”;
strcat(str2, str1);
It adds value of str1 at the end of str2 and make it – CitySunam
Question. Explain strcmp() function with suitable example.
Answer: Function strcmp stands for string compares. The strcmp( ) function is used to compare two strings. It returns one of the three possible values: zero, negative, or positive. It uses ASCII value of characters to compare strings. The function strcmp() is present in the string.h header file. Therefore, to use this function, we have to include the string.h header file in our program. Consider the the following example:
If ASCII values of 1st string is equal to ASCII values of 2nd string, It returns 0 e.g. strcmp(“punjab”,“punjab”) returns 0
If ASCII values of 1st string is less than the ASCII values of 2nd string, It returns negative value e.g. strcmp(“india”,“punjab”) return –ve value
If ASCII values of 1st string is greater than ASCII values of 2nd string, It returns +ve value e.g. strcmp(“punjab”,”india”) return +ve value
Question. Explain strupr() function with suitable example.
Answer: Function strupr stands for string upper. This function is used to convert the given string into Upper case (i.e. in capital letter). This function is present in the string.h header file. Therefore, to use this function, we have to include the string.h header file in our program. Following code shows how to use this function: strupr(“Punjab”); It converts the given string into PUNJAB.
Question. Explain strlwr() function with suitable example.
Answer: Function strlwr stands for string lower. This function is used to convert the given string into lower case (i.e. in small letter). This function is present in the string.h header file. Therefore, to use this function, we have to include the string.h header file in our program. Following code shows how to use this function: strlwr(“PUNJAB”); It converts the given string into punjab.
Question. Explain atoi () function with suitable example.
Answer: Function atoi stands for ascii to integer. This function converts the string number into integer value. This function is present in the stdlib.h header file. Therefore, to use this function, we have to include the stdlib.h header file in our program. Consider the following example: atoi(“456”); It will convert the string number “456” into integer value 456.
| CBSE Class 12 Computer Science Boolean Logic Concepts |
| CBSE Class 12 Computer Science Computer network Assignment |
| CBSE Class 12 Computer Science Communication And Network Concepts Notes |
| CBSE Class 12 Computer Science Concept of Networking Assignment |
| CBSE Class 12 Computer Science Constructors And Destructors Concepts |
| CBSE Class 12 Computer Science Data File Handling In C++ Concepts |
| CBSE Class 12 Computer Science Data Structures Assignment |
| CBSE Class 12 Computer Science Data Structures Concepts |
| CBSE Class 12 Computer Science Data Visualization Using Pyplot Assignment |
| CBSE Class 12 Computer Science Database And SQL Concepts |
| CBSE Class 12 Computer Science Database Concepts Assignment |
| CBSE Class 12 Computer Science File Handling in Python Assignment |
| CBSE Class 12 Computer Science Functions In Python Assignment |
| CBSE Class 12 Computer Science Idea Of Efficiency Assignment |
| CBSE Class 12 Computer Science Inheritance Concepts |
| CBSE Class 12 Computer Science Interface Python with SQL Assignment |
| CBSE Class 12 Computer Science Introduction and Basics of Computers Assignment |
| CBSE Class 12 Computer Science Library Functions Assignment |
| CBSE Class 12 Computer Science Object Oriented Programming Concepts |
| CBSE Class 12 Computer Science Pointers Concepts |
| CBSE Class 12 Computer Science Programming In C++ Concepts |
| CBSE Class 12 Computer Science Revision Of The Basics Of Python Assignment |
| CBSE Class 12 Computer Science Society Law And Ethics Assignment |
| CBSE Class 12 Computer Science Structured Query Language SQL Assignment |
| CBSE Class 12 Computer Science User Defined Functions Assignment |
| CBSE Class 12 Computer Science Window Movie Maker I Assignment |
| CBSE Class 12 Computer Science Window Movie Maker II Assignment |
Important Practice Resources for Class 12 Computer Science
CBSE Class 12 Computer Science Strings Assignment
Access the latest Strings assignments designed as per the current CBSE syllabus for Class 12. We have included all question types, including MCQs, short answer questions, and long-form problems relating to Strings. You can easily download these assignments in PDF format for free. Our expert teachers have carefully looked at previous year exam patterns and have made sure that these questions help you prepare properly for your upcoming school tests.
Benefits of solving Assignments for Strings
Practicing these Class 12 Computer Science assignments has many advantages for you:
- Better Exam Scores: Regular practice will help you to understand Strings properly and you will be able to answer exam questions correctly.
- Latest Exam Pattern: All questions are aligned as per the latest CBSE sample papers and marking schemes.
- Huge Variety of Questions: These Strings sets include Case Studies, objective questions, and various descriptive problems with answers.
- Time Management: Solving these Strings test papers daily will improve your speed and accuracy.
How to solve Computer Science Strings Assignments effectively?
- Read the Chapter First: Start with the NCERT book for Class 12 Computer Science before attempting the assignment.
- Self-Assessment: Try solving the Strings questions by yourself and then check the solutions provided by us.
- Use Supporting Material: Refer to our Revision Notes and Class 12 worksheets if you get stuck on any topic.
- Track Mistakes: Maintain a notebook for tricky concepts and revise them using our online MCQ tests.
Best Practices for Class 12 Computer Science Preparation
For the best results, solve one assignment for Strings on daily basis. Using a timer while practicing will further improve your problem-solving skills and prepare you for the actual CBSE exam.
You can download free Pdf assignments for CBSE Class 12 Computer Science Strings from StudiesToday.com
All topics given in Strings Computer Science Class 12 Book for the current academic year have been covered in the given assignment
No, all Printable Assignments for Strings Class 12 Computer Science have been given for free and can be downloaded in Pdf format
Latest syllabus issued for current academic year by CBSE has been used to design assignments for Strings Class 12
Yes, we have provided detailed answers for all questions given in assignments for Strings Class 12 Computer Science
