Erxaxas
ANAND NIKETAN                                                   SHILAJ CAMPUS
                                    HALF-YEARLY EXAMINATION: 2024-25
                                           Subject: Computer Applications
   STD: X                                                                                  M.M: 100
   Date: 28/09/24                                                                          Duration: 3 hrs
                        Answers to this Paper must be written on the paper provided separately.
                             You will not be allowed to write during the first 15 minutes.
                                  This time is to be spent inreading the question paper.
                  The time given at the head of this Paper is the time allowed for writing the answers.
                                           This Paper is divided into two Sections.
                      Atempt all questions from Section Aand any four questions from Section B.
                     The intended marks for questions or parts of questions are given in brackets| 1.
                                                  SECTION A (40 Marks)
                                          (Atempt all questions fromthis Section.)
          Question 1                                                                                [20]
          Choose the correct answers to the questions from the given options.
          (Do not copy the questions,write the correct answers only.)
          (i)     What is the precedence of the logical operators
                      (a)    &&, ||, !
                       (b) !,||, &&
                      (c)    !, &&,||
                      (d)    None
          (ii)     Evaluate the value of n,if value ofp-5, q=19
                       int n = (q-p) > (p-q) ? (q-p) : (p-q)
                       (a)   14.0
                       (b)   14
                       (c)   -14
                       (d)   None
          (iii)     Cell numbers ofa dimensional array is also known as?
                       (a)   packets
                       (b)   blocks
                       (c)   subscripts
                       (d)   compartments
(iv)    Name the package that contains the class:
                       BufferedReader           ii     Scanner
            (a) java.util. *
            (b) java.io.*
            (c)    Both
            (d) None
(v)     The access specifier that gives least accessibility is:
            (a) package
            (b) public
            (c)    protected
            (d)    private
(vi)    Java Virtual Machine (JVM) is an:
            (a) byte code
            (b) compiler
            (c)    machine code
            (d) interpreter
(vii)   Which of the following is an escape sequence character in Java?
            (e)   /n
            ()    t
            (g) t
            (h) //n
(vii) if (m>n && n>p) then largest number is:
           (a)
           (b) p
           (c)
           (d)    wrong expression
(ix)     What is the output of: double b = -15.6;
            double p= Math.rint(Math.abs(b);
            (a)    15.0
             (b) 15
            (c)    16
            (e)    16.0
(x)      What is the method to check whether a character is a letter or digit?
            (a)   isDigit(char)
            (b)   isLetterOrDigit()
            (c)   isLetterOrDigit(char)
            (d)   isLETTERorDIGIT(char)
(xi)     The extension of a Java source code file is:
            (a)   exe
            (b)   obj
            (c)   jvm
            (d)   java
         Automatic conversion of primitive data into an object of wrapper class is called:
(xii)
            (a)   explicit conversion
            (b)   autoboxing
            (c)   shifting
           (d)    None
(xiii)   A dimensional array is also known as:
           (a)    Actual variable
           (b)    Compound variable
           (c)    Subscripted variable
           (d)    None
(xiv)   Which of the following are entry controlled loops?
                 1       for
                 2       while
                 3       do..while
                 4       switch
           (a)   only 1
           (b)       land 3
           (c)       land 2
           (e)   3 and 4
(xv)    The output of:
           StringBuffer sb = new StringBuffer("EXAMINATION"):
           System.out.printIn(sb.delete(2,5):
           (a)   ENATION
           (b)   EINATION
           (c)   EXATION
           (d)   EXNATION
(xvi)   If the name of the class is "Alphabet", what can be the possible name for its
        constructors?
           (a)   Alphabet
           (b)   ALPHABET
           (c)   Alpha
          (d)    Alphabet
(xvii)   Which of the following mathematical methods returns only an integer?
           (a)    Math.ceil(n)
           (b)    Math.round(n)
           (c)    Math.abs(n)
           (d)    Math.sqrt(n)
 (xvii) The correct statement to create an object named skoda of class car:
           (a)    Car Skoda= new car():
            (b)   car skoda = new skoda);
            (c)    Skodacar=new Skoda():
            (d)   car skoda= new car();
 (xix)   What will be the output of:
             String sl=Technology"
            System.out.println("The output = "tsl.charAt(5))
            (a)
            (b)   n
            (c)   1
            (d)   None
 (xx)    What is the output of the Java code given below?
         String color [ ]="Red", "Blae", "Yellow"}:
         System.out.println(color[2|.length);
           (a)    5
            (b)   6
           (c)    3
           (d)    2
Question 2
 (i)           Write Java expression for:                                                           (2]
                   -b+ vb2 - 4ac
                         2a
 (ii)         Give the output of the following expression:                                      [2]
               b+=b++ + + +b + --b +b-; when b =7;
                                                                                               [2]
  (iii)        A Java program uses a Compiler as well as an Interpreter. Explain.
                                                                                is the loop    [2]
  (iv)         Give the output of the following program segment. How many times
               executed?
                       for(x=10; x>20;x++)
                       System.out.println(x);
                       System.out.println(x*2);
                   If Stringx = "Computer";                                                   [21
  (v)
               String y = "Applications";
               What do the following functions return?
               (a)     System.out.println(x.substring(1,5));
               (b)     System.out.print1n(x.indexOf(x.charAt(4);
               (c)     System.out.println(y + X.substring(5);
              (d)      System.out.println(x.equals(y)):
             Consider the following two-dimensional array and answer the questions given      [2]
 (vi)
             below:
                     int x[ ][ ]={(4,3,2}, {7,8.2}, {8, 3,10}. {1, 2, 9}}:
             (a)     What is the order of the array?
             (b)     What is the value of x{0][0]+x[2|[2]?
 (vi)        Differentiate between sequential sort and bubble sort.                           [2]
                                                                                    [2]
(viil)   Find errors in the following snippet:
         (a) int p       10;
                switch(p)
                casel: qFp*2:
                break:
                case2: q-pt2;
                break:
                case3: q-p-2:
                break:
                                                                                    [2]
(ix)     Give the output of the following:
         (a) int a] = new int [5];
                a[0] =4; a[1]= 8; al[2] =7; a[3]= 12; a[4]=3;
                System.out.println(a[2+1]);
         (b) int a[4] = {2,4,6,8};
                for(i-0;i<=l;itt) {
                s-afi] + a[3-i]:
                System.out.printIn(s);
                                                             times the loop runs.   (2]
(x)      Predict the output and also mention the number of
         int a = 0:
          whilela >-5){
         System.out.println(a +*");
         System.out.println((--a * 2));
         System.oul.print1n();
         --a;
                                           SECTION B(60 Marks)
                                 (Answer any four questions from this Section.)
       The answers in this section should consist ofthe programs in either BlueJ environment or any
                                  program environment with Java as the base.
Each program should be written using variable description /mnemonic codes so that the logic of the
                                  program is clearly depicted.
                                  Flowcharts and algorithms are not required.
    Question 3                                                                                  [15]
    (a.)
    Write a menu driven class to accept a number from the user and check whether it is
    Palindrome or a Perfect number.
      1. Palindrome number: A number is a Palindrome which when read in reverse order is
          same as read in the right order Example: 11, 101, 151, etc.
       2. Perfect number: A number is called Perfect if it is equal to the sum of its factors
           other than the number itself.
           Example: 6 = 1+2+3
(b.)
Write a program in Java to find the sum of the given series:
1+3+7+ 15 +31 +.... +(220- 1)                  2-2,          21,
Question 4                                                                                      [15]
(a.)
                                                            string in order of their lengths
Write aprogram to input a sentence and arrange words of the
from shortest to longest.
(b.)
                                                         uppercase. Count and output the
Write a program to accept astring. Convert the string to
number of double letter scquences that exist in the string.
Sample Input:                             APPLE"
"SHE WAS FEEDINGTHE LITTLE RABBIT WITH AN
Sample Output:
4
Question 5
                                                                                                 [15]
Define a class to overload the method perform as
                                                 follows:
double perform (double r, double h)         to calculate and return the value of
                                               Curved surface area of conc
                                                 CSA = rl l= yr2 + h2
void perform (int r, int c)                    Use NESTED FOR LOOP to generate the
                                               following format
                                                r=4,c=5output           1234 5
                                                                         1234 5
                                                                        1234 5
                                                                        1234 5
 void perform (int m, int n, char ch)           to print the quotient of the division of m and
                                                n if ch is Q else print the remainder of the
                                                division of m and n if ch is R
 Question 6
                                                                                                 [15]
 Define a class to accept the gmail id and check for its validity.
 A gmail id is valid only if it has:
         a
             (dot)
         gmail
         Com
               Example: icse2024(@gmail.com /s a valid gmail id.
  Question 7                                                                                     [l5]
  Define a class pin code and store the given pin codes in a single dimensional array. Sort
  these pin codes in ascending order using the Selection Sort technique only. Display the
  sorted array.
        110061, 10001,110029, 110023, 110055, 110006, 110019, 110033
Question 8
Write a program in Java to store
 Array. Find the transpose of the the numbers in a 4*4 matrix in a Double
 o1 a matr1x is                  matrix by
                 obtained when we change using   an assignment
                                                               statement.
                                                                           Dimensional
                                                                          The transpose
clements into roWs.                        the  row  elements into column and colunmn
Sample Output:
The   numbers of the matrix are
12 21 13 14
24 41 51 33
 61 11 30 29
59 82 41 76
The transpose of the matrix is
 12 24 61 59
 21 41 1| 82
 13 51   30 41
 14 33 29 76