36 solutions available
Question 1How do you create strings implicitly and explicitly?
Question 2How are Strings different from StringBuffers ?
Question 3How can you convert a numeric value enclosed in a string format ?
Question 5State the data type and values of a and b after the following segment is executed.String s1 = "Computer", s2 = "Applications"; a =...
Question 6What do the following functions return for :String x = "hello"; String y = "world";(i) System.out.println(x + y);(ii)...
Question 7What will the following code output ?String s = "malayalam" ; System.out.println(s.indexOf('m')); System.out.println(s.lastIndexOf('m'));
Question 8If:String x = "Computer"; String y = "Applications";What do the following functions return?(i) System.out.println(x.substring(1,5));(ii)...
Question 2(viii)Mention the purpose and syntax of compareToIgnore() method.
Question 10What will be the output of the following code snippet when combined with suitable declarations and run?StringBuffer city = new...
Question 11What will be the output for the following program segment?String s = new String ("abc"); System.out.println(s.toUpperCase( ));
Question 12Give the output of the following program :class MainString { public static void main(String[ ] args) { StringBuffer s =...
Question 3(ii)Differentiate between equals() and == .
Question 3(iii)Differentiate between startsWith() and endsWith().
Question 3(iv)Differentiate between indexOf() and lastIndexOf().
Question 3(v)Differentiate between compareTo() and compareToIgnore().
Question 17Design a class to overload a function check( ) as follows :(i) void check(String str, char ch) - to find and print the frequency of a...
Question 5Write a program to input a sentence and arrange each word of the string in alphabetical order.import java.util.Scanner; public class...
Question 6Write a program to input a sentence and arrange words of the string in order of their lengths from shortest to longest.import...
Question 7Write a program to input a string in uppercase and print the frequency of each character.Sample Input : COMPUTER HARDWARESample...
Question 8Write a program to input a string and print each word of the string in the reverse order.Sample Input:Enter a string: My name is...
Question 9Write a program in Java to accept a string and display the number of uppercase, number of lowercase, number of special characters and...
Question 10Write a program to enter a sentence from the keyboard and count the number of times a particular word occurs in it. Display the frequency...
Question 11Write a program in Java to enter a string/sentence and display the longest word and the length of the longest word present in the...
Question 12Write a program to accept a string. Convert the string to uppercase. Count and output the number of double letter sequences that exist in...
Question 13Write a program to input twenty names in an array. Arrange these names in descending order of alphabets, using the bubble sort...
Question 14Given below is a hypothetical table showing rates of Income Tax for male citizens below the age of 65 years:Taxable Income (TI)Income Tax...
Question 15Write a program to accept the names of 10 cities in a single dimensional string array and their STD (Subscribers Trunk Dialling) codes in...
Question 16Write a program to input forty words in an array. Arrange these words in descending order of alphabets, using selection sort technique....
Question 17Define a class named movieMagic with the following description:Instance Variables/Data Members:int year - to store the year of release of...
Question 18Write a program to accept name and total marks of N number of students in two single subscripts array name[] and totalmarks[].Calculate...
Question 19Design a class RailwayTicket with the following description:Instance Variables/Data Members:String name: to store the name of the...
Question 20Design a class to overload a function check() as follows:void check(String str, char ch) - to find and print the frequency of a character...
Question 21Design a class to overload a function Joystring() as follows:void Joystring(String s, char ch1, char ch2) with one string argument and two...
Question 22Design a class to overload a function num_calc() as follows:void num_calc(int mini, char ch) with one integer argument and one character...
Question 23Design a class to overload a function compare( ) as follows:void compare(int, int) - to compare two integer values and print the greater...
Question 4Given the codeString s1 = "yes" ; String s2 = "yes" ; String s3 = new String(s1) ;Which of the following would equate to False ?s1 == s2s3...