HE AIR FORCE SCHOOL: SUBROTO PARK: DELHI CANTT WT-II SUB: INFORMATICS PRACTICES ANSWER KEY. 1. (a) What will be the output of the code 2

Similar documents
INDIAN LEARNERS OWN ACADEMY,kuwait

Downloaded from

15 Create a Java GUI application which has the following interface as shown below:

TIME : 3 Hrs MAX. MARKS : 70 SET 1

3-Rewrite the following program code using a Switch statement: 2

Q2. What will be displayed in jtextfield1 and jtextfield2 after the following code is executed:

KENDRIYA VIDYALAYA ONGC PANVELSESSION ENDING EXAM

INDIAN SCHOOL SOHAR FINAL EXAMINATION ( ) INFORMATICS PRACTICES (065)

Half Yearly Examination SESSION: CLASS: Scholars 2 Subject :- Informatics Practices (ANSWER KEY) SECTION-A

INDIAN LEARNERS OWN ACADEMY, KUWAIT Informatics Practices XII Holiday Homework. b. What is the importance of abstract classes in programming?

SESSION ENDING EXAMINATION CLASS XI SUBJECT : INFORMATICS PRACTICES (065) Time Allowed : 3 Hrs. Max Marks : 70

I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK a) What is the difference between Hardware and Software? Give one example for each.

Answer any four from (a) to (g) questions : (4 x 2=8)

INDIAN SCHOOL SOHAR FIRST TERM EXAM ( ) INFORMATICS PRACTICES

BLUE PRINT. S.No. Topic Marks 1 Java Programming 30 2 Database concepts 35 3 IT Applications 5

DEHRADUN PUBLIC SCHOOL II-TERM ASSIGNMENT ( ) SUBJECT-INFORMATICS PRACTICES (065) CLASS XI

MONTHLY TEST (JUNE 2018) CLASS XII INFORMATICS PRACTICES

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE

Mr. Bansal accepts payment through three types of credit cards. The discount is given according to the following scheme:


1. Answer the following : a) What do you mean by Open Source Software. Give an example. (2)

ASSIGNMENT FOR AUTUMN BREAK CLASS XI INFORMATICS PRACTICES ( )

Kendriya Vidyalaya No1 Rewa Pre-Board I ( )

IMPORTANT JAVA APPLICATION

1. Answer the following questions: a. Explain Real Time OS.

Informatics Practices, Class XII ( ) (Summer Vacation-2015) (Holiday H.W) Java Concepts & Programming, MySQL

Programming in Haskell Aug-Nov 2015

D.A.V. PUBLIC SCHOOL, NEW PANVEL

Java Programming Language Mr.Rungrote Phonkam

Lecture Notes: ESC 101

SAMPLE QUESTIONS FOR DIPLOMA IN INFORMATION TECHNOLOGY; YEAR 1

Sample Paper 2015 Class XII- Comm Subject INFORMATICS PRACTICES. Q1 a) Rewrite the code using While Loop? 2

Q1. (a) (½) (b) (½) (c) (½) (d) (½) (e) (2) (f) (1) (g) (1) above address object/device assigned (h) (4) Q2. (a) (1) (b) (1) (c) (1) (d) (1)

INDIAN SCHOOL MUSCAT THIRD PRELIMINARY EXAMINATION INFORMATICS PRACTICES

COMPUTER APPLICATIONS

Kendriya Vidyalaya Sangathan (Chandigarh Region) Blue Print of Question Paper Class: XI Subject: Informatics Practices Session

APCS Semester #1 Final Exam Practice Problems

KENDRIYA VIDYALAYA SANGATHAN, ERNAKULAM REGION INFORMATICS PRACTICES CLASS XII PRE-BOARD-I

CS141 Programming Assignment #8

BRAIN INTERNATIONAL SCHOOL. Term-I Class XI Sub: Computer Science Revision Worksheet

Subject: PIC Chapter 2.

Subodh Public School

CS111: PROGRAMMING LANGUAGE II

CHAPTER 5 FLOW OF CONTROL

Time Allowed :3 hours Maximum Marks : 70

INFORMATICS PRACTICES

KENDRIYA VIDYALAYA ALIGANJ SHIFT-II HOLIDAY HOMEWORK CLASS-XII INFORMATICS PRACTICES

INFORMATICS PRACTICES

(c) ((!(a && b)) == (!a!b)) TRUE / FALSE. (f) ((!(a b)) == (!a &&!b)) TRUE / FALSE. (g) (!(!a) && (c-d > 0) && (b!b))

MARKING SCHEME INFORMATICS PRACTICES (065) Time allowed : 3 Hours M. M.: 70. (a) Ans: Team Viewer( 1 mark for correct answer)

Conditional Control Structures. Dr.T.Logeswari

Downloaded from

C++ Programs(CONDITIONAL CONSTRUCTS & LOOPS)

SAMPLE PAPER: 2015 Class :XII Subject : Informatics Practices. Time: 3 hrs. M.M. 70. Section A

CLASS XII SAMPLE PAPER-065 INFORMATICS PRACTICES

Sample Paper 2012 Class XII Subject Informatics Practices

SAMPLE PAPER-2015 CLASS-XII Subject: Informatics Practices. Time: 3 hours Max. Marks: 70

APEEJAY SCHOOL SAKET First Term Examination Class - XII (Commerce) INFORMATICS PRACTICES(Code 065)

INFORMATICS PRACTICES

INDIAN SCHOOL MUSCAT THIRD PRELIMINARY EXAMINATION INFORMATICS PRACTICES

DECISION CONTROL AND LOOPING STATEMENTS

INFORMATICS PRACTICES (065)

SBOA SCHOOL & JUNIOR COLLEGE, CHENNAI 101 COMPUTER SCIENCE CLASS: XI HALF YEARLY EXAMINATION MAX MARKS:70 CODE - A DURATION : 3 Hours

SECOND TERMINAL EXAMINATION, 2017 INFORMATICS PRACTICES

12 CREATING NEW TYPES

Chapter 3. Iteration

CHAPTER 3 JAVA GUI PROGRAMMING REVISION TOUR - I. The smallest individual unit a program is known as a Token. Java has following types of tokens:

PROGRAMMING FUNDAMENTALS

C212 Early Evaluation Exam Mon Feb Name: Please provide brief (common sense) justifications with your answers below.

CHAPTER 2.2 CONTROL STRUCTURES (ITERATION) Dr. Shady Yehia Elmashad

13. What is the meaning of Open Source in the term Open Source Database Management. 14. Difference between Proprietary and Open Source Software.

Application based QUESTIONS for JAVA

CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING Chapter 4: Repetition Control Structure

AIMMS Function Reference - Date Time Related Identifiers

KENDRIYA VIDYALAYA SANGATHAN BLUE PRINT INFORMATICS PRACTICES CLASS XII TOPICS SA(1) SA(2) LA(6) TOTAL

Downloaded from Set :B SECTION A

ARRAYS(II Unit Part II)

Java Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application

Conditionals. For exercises 1 to 27, indicate the output that will be produced. Assume the following declarations:

OPERATING MANUAL FOR AUTOMATIC SCHOOL BELL Ringing bell in manual mode: When unit is at Home Screen, showing date and time on

Downloaded from

Visit For All NCERT solutions, CBSE sample papers, Question papers, Notes for Class 6 to 12

A control structure refers to the way in which the Programmer specifies the order of executing the statements

Sample Paper-2011 Class : XII MM : 70 Subject : Informatics Practices Time : 3 hours

D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ASSESSMENT CLASS - XI COMPUTER SCIENCE

SCHEDULED PROGRAMMES/COURSES APRIL 2017 MARCH 2018 (MIND KINGSTON / MANDEVILLE CAMPUSES & MONTEGO BAY)

KENDRIYA VIDYALAYA SANGATHAN BLUE PRINT INFORMATICS PRACTICES CLASS XII

Time : 3 hours Max. Marks : 70

CS141 Programming Assignment #4

UNIVERSITY OF MALTA FACULTY OF INFORMATION AND COMMUNICATION TECHNOLOGY Department of Computer Information Systems


Name :. Roll No. :... Invigilator s Signature : INTRODUCTION TO PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

Sample Paper for class XII IP with Answers Prepared by Successbook Group Sub: - Informatics Practices Total Marks :70 Time:3hr

CS 170 Exam 2. Version: A Spring Name (as in OPUS) (print): Instructions:

C# Fundamentals. Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh

INDIAN SCHOOL MUSCAT FINAL TERM EXAMINATION INFORMATICS PRACTICES

SESSION ENDING EXAMINATION Set-3 INFORMATICS PRACTICES CLASS XI BLUE PRINT Long Short Very Short

DEHRADUN PUBLIC SCHOOL ASSIGNMENT SUBJECT-INFORMATICS PRACTICES (065) CLASS XI

KENDRIYA VIDYALAYA SANGATHAN, ERNAKULAM REGION MODEL QUESTION PAPER INFORMATICS PRACTICES (065) ANSWER KEY- SET-2

Accelerating Information Technology Innovation

Transcription:

HE AIR FORCE SCHOOL: SUBROTO PARK: DELHI CANTT. 110010 WT-II CLASS : XI SET I SUB: INFORMATICS PRACTICES ANSWER KEY MAX MARK: 30 TIME ALLOWED : 1Hr 10 Mins 1. (a) What will be the output of the code 2 int f=1,i=2; do f*=i; i=i+1; while(i<5); System.out.println(f); Ans: 24 (b) The following code has some errors. Rewrite the correct code. Underline the corrections made. 2 Float ch; switch(ch); case a : case A ; case e : case E : case i : case i : case u : case U : ++vowels; default : ++others; Ans: char ch; int vowvels,others; switch(ch)_ case a : case A : case e : case E : case I : case i : case u : case U : ++vowels; default : ++others; (c) Rewrite the following program code using a for loop: 2 IP class XI WT2 answer key Page 1 of 10

int i,sum=0;` while(i<10) sum +=i; i+=2; Ans: int i,sum=0; for(i=0;i<10;i+=2) sum +=i; (d) Write the name of the control used for the following 2 i. User has to give a multiline input TEXTAREA ii. Picture to be displayed. LABEL iii. Execution of statements BUTTON iv. A heading is to be displayed LABEL 2. (a) Differentiate between radio button and check box. Give any 1 method common to these controls? 2 RadioButton: Allow us to choose a single item from a group of jradiobutton options. It is circular in shape and a dot appears when selected. CheckBox: Allow us to choose one or more items from a group of jcheckbox options. It is square in shape and a tick appears when selected. METHOD- isselected() (b) Differentiate between do while and while loop with example. 2 While loop : The while loop is an entry-controlled loop. It means that the loop condition is testedbefore executing the loop body. If the loop condition is initially false, for the first iteration, then loop may not execute even once. The syntax of the while loop is as follows: Syntax while(test expression) loop body do while : Do..While loop is an exit-controlled loop. In the do..while loop, the test occurs at the end of the loop. This ensures that the do..while loop executes the statements included in th e loop body at least once. IP class XI WT2 answer key Page 2 of 10

The syntax of the loop is as follows: Syntax : do loop body while (test expression); 3.Create an application in Java using GUI to calculate the largest of 3 floating point numbers? 2 float a = Float.parseFloat(t1.getText()); float b = Float.parseFloat (t2.gettext()); float c = Float.parseFloat (t3.gettext()); if((a>b)&&(a>c)) l1.settext( a is largest ); else if((b>a)&&(b>c)) l1.settext( b is largest ); else l1.settext( c is largest ); 4.Create an application in Java using GUI to find the cube if a float number entered by the user if it is greater than 100 and square of a number if it is less than 100. Take the number as input from the user. 2 float a = Float.parseFloat(t1.getText()); if(a>100) res=a*a*a; else res=a*a; t2.settext( +a); 5.Create an application in Java using GUI to print the table of a number entered by the user. 2 int a = Integer.parseInt(t1.getText()); for (int i=1;i<=10;i++) ta1.append(i*a+ \n ); 6. Create a java application that will print odd numbers from 2 to 100? 2 for (int i=3;i<=100;i++) ta1.append(i+ \n ); 7.Create an application in Java to print the weekday for the corresponding weekday number entered? 3 IP class XI WT2 answer key Page 3 of 10

int day = Integer.parseInt(t1.getText()); switch (day) case 1 : l1.settext( Mon ); case 2 : l1.settext( Tues ); case 3 : l1.settext( Wed ); case 4 : l1.settext( thur ); case 5 : l1.settext( Fri ); case 6 : l1.settext( sat ); case 7 : l1.settext( Sun ); default : l1.settext( wrong number entered ); 8.Write an application in Java i. To calculate the net amount based on the conditions given below. 4 Mode of payment Discount Platinum 20% Silver 15% Gold 10% An additional discount of 5% will be given if the bill amount is more than 50000 IP class XI WT2 answer key Page 4 of 10

jtextfield4.seteditable(false); jtextfield5.seteditable(false); float Offer = 0; // For offer float AddOffer = 0; // For additional offer if (jradiobutton1.isselected()==true) Offer = Float.parseFloat(jTextField2.getText()) * 20/100; else if (jradiobutton2.isselected()==true) Offer = Float.parseFloat(jTextField2.getText()) * 15/100; else if (jradiobutton3.isselected()==true) Offer = Float.parseFloat(jTextField2.getText()) * 10/100; // Displaying the offer amount in jtextfield3 jtextfield3.settext(string.valueof(offer)); // Calculating additional offer amount if (Float.parseFloat(jTextField2.getText()) > 50000) AddOffer = Float.parseFloat(jTextField2.getText()) * 5/100; // Displaying the additionl offer amount in jtextfield4 jtextfield4.settext(string.valueof(addoffer)); jbutton2.setenabled(true); ii. Write the code for clear button to clear all text box contents and disable the calculate discount and calculate net amount button. 2 T1.setText( ); T2.setText( ); T3.setText( ); T4.setText( ); T5.setText( ); Calbutton.setEnabled(false); Calbutton1.setEnabled(false); iii. Write the code for exit button to close the application. 1 System.exit(0); IP class XI WT2 answer key Page 5 of 10

THE AIR FORCE SCHOOL: SUBROTO PARK: DELHI CANTT. 110010 WT-II CLASS : XI SET II SUB: INFORMATICS PRACTICES ANSWER KEY MAX MARK: 40 TIME ALLOWED : 1Hr 10 Mins 1. (a) What will be the output of the code 2 1 int Num = 1; do jtextarea1.settext(num + "\n"); Num = Num + 1; while(num>=10); (c) The following code has some errors. Rewrite the correct code. Underline the corrections made. 2 int sum;value;inct; int i for(i==0;i<=10;i++) sum=sum+i; inct++; system.out.print(inct); Ans : int sum,value,inct; int i; for(i=0;i<=10;i++) sum=sum+i; inct++; System.out.print(inct); (c) Rewrite the following program code using a while loop 2 int i,j; for(i=1;i<=4;i++) System.out.print(j); System.out.println(); Ans: int i=1,j; while(i<=4) System.out.print(j); i++; System.out.println(); IP class XI WT2 answer key Page 6 of 10

(d) Write the name of the control used for the following 2 v. User has to give a multiline input TEXTAREA vi. Select nationality RADIO BUTTON vii. Select gender RADIO BUTTON viii. A heading is to be displayed LABEL 2. (a) Differentiate between Text field and Password field components 2 The Text Field displays the obtained text in unencrypted form and we can extract the text using gettext()whreas password field displays the obtained text in encrypted form. This component allows confidential input like passwords which are single line. and we can extract the text using getpassword() (b) Differentiate between entry controlled and exit controlled loop with example. 2 Entry Controlled loop : It means that the loop condition is tested before executing the loop body. If the loop condition is initially false, for the first iteration, then loop may not execute even once.eg while loop. The syntax of the while loop is as follows: Syntax while(test expression) loop body (iii) Exit Controlled loop: an exit-controlled loop tests the condition occurs at the end of the loop. This ensures that the do..while loop executes the statements includ ed in the loop body at least once. The syntax of the loop is as follows: Syntax : do loop body while (test expression); 9.Create an application in Java using GUI to calculate the smallest of 3 floating point numbers? 2 float a = Float.parseFloat(t1.getText()); float b = Float.parseFloat (t2.gettext()); float c = Float.parseFloat (t3.gettext()); if((a<b)&&(a<c)) l1.settext( a is smallest ); else if((b<a)&&(b<c)) l1.settext( b is smallest ); else l1.settext( c is smallest ); IP class XI WT2 answer key Page 7 of 10

10. Create an application in Java using GUI to find the area of a square if the choice entered by the user is 1 and area of a rectangle if the choice is 2 and should print invalid for any other choice. 2 int choice = Integer.parseInt(t1.getText()); switch(choice) case 1 : float s = Float.parseFloat(t1.getText()); ans = s*s; case 2: float l = Float.parseFloat(t1.getText()); float b = Float.parseFloat(t2.getText()); ans = l*b; default : lans.settext( invalid ); lans.settext( ans= +ans); 11. Create an application in Java using GUI to print the table of a number entered by the user. 2 int a = Integer.parseInt(t1.getText()); for (int i=1;i<=10;i++) ta1.append(i*a+ \n ); 12. Create an application in Java to print all numbers between the 2 numbers entered by the user. 2 int low = Integer.parseInt(t1.getText()); int high = Integer.parseInt(t1.getText()); for (int i=low;i<=high;i++) ta1.append(i+ \n ); 13. Create an application in Java to print the corresponding month name in case the user enters number from 1 to 6 and should print invalid if number entered is more than 6? 3 int day = Integer.parseInt(t1.getText()); switch (day) IP class XI WT2 answer key Page 8 of 10

case 1 : l1.settext( Jan ); case 2 : l1.settext( Feb ); case 3 : l1.settext( Mar ); case 4 : l1.settext( Apr ); case 5 : l1.settext( May ); case 6 : l1.settext( June ); default : l1.settext( invalid ); 14. Write an application for the following. i. Write the coding for CALCULATE button which calculates and displays the discount percentage and discounted price based on the table given below 4 OPTION DISCOUNT % CASH NIL CREDIT CARD 25% IP class XI WT2 answer key Page 9 of 10

float dis,disc; float amt = Float.parseFloat(t1.getText()); if(jradiobutton1.isselected()==true ) Dis=0; else if(jradiobutton2.isselected()==true ) Dis=25; T2.setText(dis+ % ): Disc=amt-amt*dis/100; T3.setText(disc+ ); ii. Write the code for clear button to clear all text box contents and disable the calculate button. 2 T1.setText( ); T2.setText( ); T3.setText( ); Cmdbutton.setEnabled(false); iii. Write the code for exit button to close the application. 1 System.exit(0); IP class XI WT2 answer key Page 10 of 10