Indian Learners Own Academy

Indian Learners Own Academy

<p> INDIAN LEARNERS OWN ACADEMY INFORMATICS PRACTICES - XII ASSIGNMENT 3 GUI PROGRAMMING - A REVIEW Submission Date: 10-04-2017</p><p>1. Identify the following as valid variable names, state reason if invalid. a) _123 b)break c)var.1 d)S$ f)D123 g) A * 4 h) D 23 i) roll_no e) emp No g) withdrawamt</p><p>2. What will be the result of a = 5/3 if a is (i) float (ii) int? 3. What will be the value of j = --k + 2*k + l ++ if k is 20 initially? 4. What will be the value of P=P* ++ J where J is 22 and P = 3 initially? 5. What will be the resultant type of the following expression if bh represents a byte variable, i is an int variable, fl is a float variable and db is a double variable? (i) bh – I + db/fl – i*fl + db/i (ii) (int) (fl + db) 6. If a String MyString holds a value “12345”, then write the command to convert it into integer type. 7. What will be the output of the following statement? jTextField1.setText(“1”+3); 8. What will be the output of the following statement? int x; x=5; jTextArea1.append(String.valueOf(x++)); jTextArea1.append(String.valueOf(x)); jTextArea1.append(String.valueOf(++x)); 9. What will be the output of the following statement? int a; a= 25 + 4 – 4; jTextField1.setText(“a = “ + String.valueOf(a)); 10. What will be the output of the following statement? int a, b = 30; a = 30 / 2 * b; jTextField1.setText(String.valueOf(a)); 11. What will be the output of the following statement? int p = 10, k = 20; k = k / ++p; jTextField1.setText(“k = “ +String.valueOf(a)); 12. Determine the output int z, x = 5, y= -10, a = 4, b = 2; z = x++ - --y * b/a;</p><p>13. Write the results of the following Java statements: int a= 10, b = 4, c, d; c = ++a – b-- * 2; d = a/2 * 5 - --b; jTextField1.setText(String.valueOf(c)); jTextField1.setText(String.valueOf(d)); </p><p>14. Write a program to calculate area of a circle using Input.</p><p>15. What kind of constant are the following : 14, 011, 0X2A, 17, 014, 0XBC1</p><p>16. Write the output of x in the following case: int x = (5>=8) ? 1 : 2;</p><p>17. Write code in java that takes two Strings from textfields t1 and textfields t2 and display them joined together in a third textfield t3.</p><p>18. What will be the content of jTextField1 after executing the following code: int Num = 6; Num = Num + 1; if ( Num > 5) jTextField1.setText(Integer.toString(Num)); else jTextField1.setText(Integer.toString(Num+5));</p><p>19. Predict the value of C and D if they are of Boolean types if a and b are integers with values a=38 and b= - 10 then C=(a>30)&&(b>-20); D=!((a<22)||(a>10));</p><p>20. Write the value of variable ‘c’ after execution of the following code : int d = 7,c; c = (5*++d)%3; 21. Write Java code to assign the value 500 to variable x. Increase the value of x by 50 and store it in variable y. 22. Write the values of sum and x after execution of the following code : int sum, x; sum = 7; x = 5; sum = sum + (x++);</p><p>23. What will be the value X1 after the execution of the following code : String X1="Spread", X2="PEACE"; X1=X2.concat(X1);</p><p>24. What will be the content of the jTextArea1 after executing the following code : int n = 89; jTextAreal.setText(Integer.toString(++n);</p><p>25. Which of the following are valid identifiers? (i) int $y; (ii) int 678 (iii) int _333</p><p>26. What is the output of the following, if the initial value of X is 40? (i) Y = ++ X; (ii) Y = X++;</p><p>27. Write java code that takes the cost of a pencil from jTextField1 and number of pencil from jTextField2 and calculate total amount as cost*number to be displayed in jTextField3 and 20% service tax out of total amount in jTextField4.</p><p>28. Write java code that takes value for a number (n) in jTextField1 and cube (n*n*n) of it to be displayed in jTextField2.</p><p>29. Item code consisting of 5 digits is stored in an integer type variable intItemCode. Mr. Srikant wants to store this Item code in a String type variable called strItemCode. Write appropriate java statement(s) to help her in performing the same.</p><p>30. What will be the value ofa and b after execution of the following code : int a=1,b=2; if (++a<5) { a* = ++b; }</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us