Friday, 4 January 2013

Questions:ch-4,5 and 1,2,3


Q1.   
(a)     Which protocol is used for the transfer of hyper text document on the internet.                                                       (½)
            (b)   Which transmission medium should be used to transfer data across two continents at very high speed.
                                                                                                                                                                                                                                      (½)
    (c)    Two neighbourhood school, at a distance of 120 metres from each other, decide to join their LANs using UTP cables so that they can share their e – learning resources. But after joining their LANs they are not able to share resources due to loss of signal in between. Which device should they use to that signal is amplified in between?                                                                                                                                                                                                                (½)
            (d)   Which of the following software is an  Open Source:                                                                                                     (½)
      Linux, MS Window7, Photoshop.
    (e)   Distinguish between Open Sources software and Proprietory software with reference to customizability of the software.                                                                                                                                                                                     (2)
    (f)    Name any two Indian scripts included in Unicode.                                                                                                         (1)
    (g)   Sujata says that the following numbers indicate an address                                                                                       (1)
      208.77.188.166
      What is the above address called? To which object/device is it assigned?
h)


scan0083
 


Q2.    (a)   While working in Netbeans, Ms. Kavita wants to display ‘Pass’ or ‘Needs to Reappear’ message depending on the marks entered in jTextField. Help her to choose the more appropriate statement out of ‘If statement’ and ‘Switch statement’.                                                                                                                                                                         (1)
               (b)   Write one property and one method of jListBox.                                                                                                             (1)
 (C)   What will be the value of P and Q after execution of the following code?                                                            (2)
                                    int P,Q = 100
                                    for (P=10; P<12; P++)
                                    {
                                         Q+ = P;
                                    }
                                    JOptionPane. showMessageDialog(this, “p + “+P+” Q;”+Q+” );
                           
            (D)  Write Java code that takes a number from jTextField1 and displayed its table in jTextArea1.             (2)
                        (e.g 6*1=6
                               6*2=12
                              …………..
                              6*10=60)
                          (E)   Name the property of jPassword which sets the character that will be displayed instead of Text. (1)


Q3.    (a)   Define Inheritance, Class, Polymorphism with reference to object oriented programming.               (3)
(b)     A phone number, consisting of 10 digits, is stored in a string variable strPhone. Now it is required to store this phone number in a Long type variable lngPhone. Write Java statement to do this.                                                              
 (c)    Write the result stored in jTextField1 by the following statement:                                                                         (½)
                    jTextField1.setText(“Informatics”.substring(3));
 (d) Rewrite the following program code using a for loop:                                                                                                    (2)
                    int i=1, sum=0;
                    while (i<10)
                    {                                                                                                                                                                                                                sum+=i;
                      i+=2;
                    }
(e)Write different methods of JOptionPane Class.                                                                                                                        (1½)
            (f)  The following code has some error(s). Rewrite the correct code underlining all the corrections made:
                    Int i, j=5;
                    i==j+5;
                    if(i=j)
                    {  jTextField1.setText(“i and j are unequal”);
                      jTextField2.setText(“they are not equal”);   break;
                    }
 else  jTextField1.setText(“i and j are equal”)                                                                                                                                (2)
            (g) I) What will be the constants of jTextField1 and jTextField2 after executing the following code:     
                         i)  jTextField1.setText(Math.round(25.7)+ “ ”);                                                                                                            (½)
                         ii) jTextField2.setText(Math.pow(2,3)+ “ ”);                                                                                                                  (½)
                   II)  What will be the contents of F1 and F2 after the following code is executed?                                           (1)
                           String  F1=”hello”, F2=”Friend”;
                             F1=F1.concat(F2);


b) What is the difference between setEnabled and setVisible methods of a control?

c) Write the purpose of the following statements.
           i)  jTextField1.setText("Value"+Math.round(-11.5));      ii) final double g=9.8;



Q4) A phone Number , consisting of 10 digits, is stored in a string  variable strPhone. Now it                    is required to store this phone number in a long type variable lngPhone. Write a java                statement to do this.

Q5 )What does getpassword() on a password field return ?                                       (1)
(i)                 a String (ii) an integer (iii) a character array
Q6 )Predict Output:
int x = 10;
    int y = 15;
    System.ou.println((x>y)? 3.14: 3);

Q7)  Convert the following ‘while loop’ into its equivalent ‘for loop without altering the output of the program.
int x = 100, a = 30;
while ( x>= 10)
{
    System.out.println(”New Amount =”+(x + a));
    a++;
    x - = a;
}

Q8)   What is type casting?
9)    Name and explain the usage of any two data types used in Java to store numbers with decimals.
10.    What are Keywords? Give two examples of keywords available in Java.
11.    Name and explain the usage of any one relational and one logical operator in Java.
12.    What is the difference between = and == operator in java?
13.    Name the two type of selection statement available in Java.
14.    Write the purpose of Switch Statement with the help of an example. Which Java Statement can be used in place of switch statement? In the switch statement, what happens if every case fails and there is no default option?
15.    What is the purpose of ‘break’ statement in java?
16.    What is the purpose of ‘continue’ statement in java?
17.    What is the difference between entry controlled and exit controlled loop
18.What is tooltiptext?
The tooltip text is the text that appears when the user moves the cursor over a component, without clicking it. The tooltip generally appears in a small "hover box" within formation about the component being hovered over.

19.Study the following code and answer the questions that follow:
double Number,RoundedNumber;
Number=Double.parseDouble(jTextField1.getText());
RoundedNumber=Math.round(Number*1000)/1000.0;
jTextField2.setText(Double.toString(RoundedNumber));
a) How many variables have been declared in the above code? Identify and name them.
b) How many objects have been declared in the above code?
c) Name any one native class of Java used in the above code.
d) Identify and name a method of this native class.
e) Name the method used to convert one type of data to another and also mention the data type before and after conversion.

Q20) Explain two methods for converting any form of data type to String type..Give example.
Q21) Differentiate between concrete class and abstract class.
q22) What will be the content of jTextField1 and jTextField2 after executing the following code?

      String st="Happy New Year 2012";
      jTextField1.setText(""+st.substring(17)+st.length());
      jTextField2.setText(st.substring(6).trim());
 
q23)
Predict output:
Public static void main(string[] args)
{
String fullname=”bill gates”;
String firstname =””;
Firstname=fullname.substring(0,2);
System.out.print(firstname);
Firstname= FullName.substring(5, 2);
System.out.print(firstname);
Firstname= FullName.substring( 5, FullName.length( ) - 3 );
System.out.print(firstname);
}

No comments:

Post a Comment