0% found this document useful (0 votes)
2 views3 pages

Array Lab Record-04

The document contains a series of programming questions focused on string manipulation tasks. It includes examples for counting vowels, reversing strings, checking for palindromes, counting words, character frequency, case conversion, string length calculation, space removal, character type counting, and finding non-repeating characters. Each question is accompanied by input-output examples to illustrate the expected results.

Uploaded by

dhwanigupta2402
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Array Lab Record-04

The document contains a series of programming questions focused on string manipulation tasks. It includes examples for counting vowels, reversing strings, checking for palindromes, counting words, character frequency, case conversion, string length calculation, space removal, character type counting, and finding non-repeating characters. Each question is accompanied by input-output examples to illustrate the expected results.

Uploaded by

dhwanigupta2402
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Lab record-04

Question 1:

Given a string, count the number of vowels (a, e, i, o, u).


Examples:
Input: "hello"
Output: 2
Input: "education"
Output: 5

Question 2:

Reverse a given string without using library functions.


Examples:
Input: "world"
Output: "dlrow"
Input: "python"
Output: "nohtyp"

Question 3:

Check whether a given string is a palindrome or not.


(A string is palindrome if it reads the same backward as forward.)
Examples:
Input: "madam"
Output: Palindrome
Input: "hello"
Output: Not Palindrome

Question 4:

Count the number of words in a given string.


Examples:
Input: "I love programming"
Output: 3
Input: "ChatGPT is awesome"
Output: 3

Question 5:

Find the frequency of each character in a string.


Examples:
Input: "apple"
Output:

a → 1
p → 2
l → 1
e → 1

Input: "banana"
Output:

b → 1
a → 3
n → 2

Question 6:

Convert all lowercase letters in a string to uppercase and vice versa.


Examples:
Input: "HeLLo"
Output: "hEllO"
Input: "Python"
Output: "pYTHON"

Question 7:

Find the length of a string without using the built-in strlen() function.
Examples:
Input: "OpenAI"
Output: 6
Input: "C programming"
Output: 13
Question 8:

Remove all spaces from a given string.


Examples:
Input: "Hello World"
Output: "HelloWorld"
Input: "Data Structures"
Output: "DataStructures"

Question 9:

Count the number of digits, alphabets, and special characters in a string.


Examples:
Input: "A1@B2#C3"
Output:

Alphabets = 3
Digits = 3
Special Characters = 2

Question 10:

Find the first non-repeating character in a string.


Examples:
Input: "swiss"
Output: "w"
Input: "success"
Output: "u"

You might also like