English

Give the output of the following string functions: (i) “ACHIEVEMENT”.replace(E’, ‘A’) (ii) “DEDICATE”.compareTo(“DEVOTE”) - Computer Applications

Advertisements
Advertisements

Question

Give the output of the following string functions: 

  1. “ACHIEVEMENT”.replace(E’, ‘A’)
  2. “DEDICATE”.compareTo(“DEVOTE”)
Answer in Brief

Solution

  1. ACHIAVAMANT
  2. –18 
shaalaa.com
  Is there an error in this question or solution?
Chapter 4: String Handling - EXERCISES [Page 288]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 4 String Handling
EXERCISES | Q IV. 11. | Page 288

RELATED QUESTIONS

Design a class name ShowRoom with the following description :
Instance variables/ Data members :

String name – To store the name of the customer
long mobno – To store the mobile number of the customer
double cost – To store the cost of the items purchased
double dis – To store the discount amount
double amount – To store the amount to be paid after discount
Member methods: –
ShowRoom() – default constructor to initialize data members
void input() – To input customer name, mobile number, cost
void calculate() – To calculate discount on the cost of purchased items, based on following criteria

Cost Discount (in percentage)
Less than or equal to ₹ 10000 5%
More than ₹ 10000 and less than or equal to ₹ 20000 10%
More than ₹ 20000 and less than or equal to ₹ 35000 15%
More than ₹ 35000 20%

void display() – To display customer name, mobile number, amount to be paid after discount
Write a main method to create an object of the class and call the above member methods.


Give the output of the following string functions:

  1. "MISSISSIPPI".indexOf('S') + "MISSISSIPPI".lastIndexOf('I')
  2. "CABLE".compareTo("CADET") 

Design a class Railway Ticket with following description: 
Instance variables/data members:
String name: To store the name of the customer
String coach: To store the type of coach customer wants to travel
long mob no: To store customer’s mobile number
int amt: To store a basic amount of ticket
int total amt: To store the amount to be paid after updating the original amount

Member methods
void accept (): To take input for a name, coach, mobile number and amount
void update (): To update the amount as per the coach selected

(extra amount to be added in the amount as follows)

Type of Coaches Amount
First_ AC 700
Second_AC 500
Third _AC 250
sleeper None

void display(): To display all details of a customer such as a name, coach, total amount and mobile number.

Write a main method to create an object of the class and call the above member methods. 


Special words are those words that start and end with the same letter.
Examples:
EXISTENCE
COMIC
WINDOW
Palindrome words are those words which read the same from left to right and vice versa
Examples:
MALAYALAM
MADAM
LEVEL
ROTATOR
CIVIC
All palindromes are special words, but all special words are not palindromes. Write a program to accept a word check and print Whether the word is a palindrome or only a special word.


Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×