Page 382 - Computer science 868 Class 12
P. 382

Let’s Revisit

                    ♦ All letters, digits, space and punctuators together known as a String.
                    ♦ There are 256 characters that can be used to perform any task using the computer.
                    ♦ ASCII – American Standard Code for Information Interchange. The range of the ASCII value is from 0 to 255.

                    ♦ There  are  many built-in  String methods.  Some  of them  are:  length(),  charAt(), indexOf(),  toLowerCase(),  toUpperCase(),
                   concat(), substring(), replace(), equals(), equalsIgnoreCase(), compareTo(), etc.
                    ♦ String Buffer functions create reasonable space in the memory.

                    ♦ Some of the StringBuffer methods are – append(), setCharAt(), insert(), delete(), setLength() and reverse().
                    ♦ Wrapper class is used to convert String to primitive data types and vice versa.
                    ♦ StringTokenizer class breaks a sentence into tokens (sequence of characters except delimiters) or words.
                    ♦ There are  five different  methods for  StringTokenizer class.  They  are:  nextToken(), hasMoreTokens(), countTokens(),
                   hasMoreElements() and nextElements().





                                                             MIND DRILL



                   Solved Questions


              A.  Tick ( ) the correct option:
                  1.  Which character method is used to find whether the character is a digit or not?
                    a.  Character.isLetter(char)                    b.  Character.isUpperCase(char)
                    c.  Character.isDigit(char)                     d.  None of these
                  2.  Character.toLowerCase(char) is used to ………………… .
                    a.  check for small letters                     b.  convert to lowercase
                    c.  convert from lowercase to capital letters   d.  checks for space
                  3.  Output of: System.out.println(Character.toLowerCase('A')); is
                    a.  A                                           b.  65
                    c.  97                                          d.  a
                  4.  There are ………………… characters that can be used to perform any task using the computer.
                    a.  128                                         b.  1
                    c.  256                                         d.  255
                  5.  This method is used to return the number of characters present in the string.
                    a.  length()                                    b.  length
                    c.  charAt()                                    d.  indexOf()
                  6.  Character.isWhitespace(char) checks for ………………… .
                    a.  space                                       b.  letter
                    c.  digit                                       d.  None of these
                  7.  (int)'B' results in ………………… .
                    a.  65                                          b.  66
                    c.  97                                          d.  98
                  8.  indexOf(char ch, int index) returns ………………… .
                    a.  char data type                              b.  int data type
                    c.  double data type                            d.  String
                  9.  str1.concat(str2) is the same as ………………… .
                    a.  str1str2                                    b.  str1 - str2
                    c.  str1+str2                                   d.  None of these


                380380  Touchpad Computer Science-XII
   377   378   379   380   381   382   383   384   385   386   387