ip assignment 2014(1)

Upload: himanshu-kumar-jha

Post on 23-Feb-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/24/2019 Ip Assignment 2014(1)

    1/14

    D e l h i P u b l i c S c h o o l , R a n c h i

    S A I L T o w n s h i p

    R a n c h i 8 3 4 0 0 4

    + 9 1 - 9 4 7 0 9 3 2 5 4 4 ( C e l l )

    + 9 1 - 9 0 9 7 5 3 6 2 0 4 ( O f f )

    1 / 3 / 2 0 1 4

    Developed & Designed by

    DR. SRIKUMAR MUKHERJEE

    (Teacher, Dept. of Computers,

    DPS, Ranchi)

    Systematic organization of habits and

    instincts with purpose of ful fi l li ng the

    becoming of li fe, by graduated active

    manipulation of behavior may be call ed

    Education.[NP Vol-3]

    Practice Paper of

    Informatics

    Practices (065) forXII Board Exam

    2014

  • 7/24/2019 Ip Assignment 2014(1)

    2/14

    Instructions for using this practice paper and preparation for writings of the answers:

    This is designed according to the text book taught in the class.

    First read / browse a chapter then go through the questions to find the answer of this paper.

    Page wise, chapter wise, important questions have been prepared.

    After ending each chapter also find the questions given at the end of the chapter. Finally also take help form the sample paper of the market.

    What to do in the examination hall?

    Just after getting the question paper, take couple of deep breaths concentrating your mind.

    Read the question paper properly, and make a plan to answer.

    As far as possible attempt the questions in the serial order.

    Theory answers must not be unnecessarily too long, it must be precise and to the point.

    Theory based programming answers of Qs 1, 2 & 3 should have example(s).

    Example is must, even it is not asked.

    Outputs must be written just as it is viewed in console-display. Be careful of error findings & outputs.

    Error finding must be Re-written in the form of full corrected program with underlined the correctedplaces of the corrected re-written program and commenting on the errors.

    Draw Line of Separation end of each answer by dark PENCIL and keep 1-2 lines gap, before you

    start to answer the next question in the examination hall.

    Don't waste the time for the question about which you are in doubt.

    Complete your all answers within 2hrs 15min and use rest 35-40 min to revise your papers.

    Before leaving Exam Hall do RE-CHECK all the answer papers properly within 5 min.

    .

  • 7/24/2019 Ip Assignment 2014(1)

    3/14

    W1W2

    W3W4

    [Question#1] NETWORKING & OPEN SOURCE SOFTWARE [TOTAL MARKS 10]

    (1) Define / Make a shor t note of the fo l lowings (Com puter Networking) : [1-2 / 2-3 marks of each]

    (a) Computer Network (b) PAN, LAN , MAN, WAN, (c) Node , Server , Hub , Workstation, TAP , NIU (d) Ring Topology , StarTopology , Tree Topology , Bus Topology, Mesh Topology (e) Data Communication (f) Twist Pair Cable , Coaxial cable,Optical fiber cable, Ethernet cable (g) Wireless Networking (h) Microwave, Radio wave, Satellite, (i) Infrared Communication (j)

    Bluetooth , WiFi (k) Modem , Hub , Ethernet card, Repeater , Bridge , Gateway , Router (l) IP address , MAC address ,Domain name (m) Define: 023.876.067.002 , www.indoaryan.org , URL (n) Differentiate: Domain Name & URL (o) .org ,.com , .edu , .net , .gov (p) Network security , Threat to Network (q) Firewall , IDS , Snooping , Danial of Service Attack orDoS Attack (r) SYN Fooding , Pentium F00F Bug , Ping Flooding , TearDrop / New Tear (s) HTTP , HTML , FTP , TCP/IP ,

    SMTP(2) Excel Industries has set up its new center at Lucknow for its office and web based activities. The company

    compound has four building as shown in the diagram below :

    Sri Ram

    Building

    KGNBuilding

    KrishnaBuilding

    Sai

    Bu ilding

    The distance between var ious b ui ldings

    are :

    KGN to Sri Ram 65m

    Sri Ram to Sai 195m

    Sai to Krishna 205m

    Krishna to KGN 200m

    KGN to Sai 195m

    Sri Ram to Krishnal 325m

    Number of computers are :

    KGN Building 158

    Krishna Building 125

    Sai Building 200

    Sri Ram Building 78

    A company in Micro Excel has 4 wings of buildings as shown in the diagram:

    Center to center distancesbetween various Buildings:

    W3 to W1 50mW1 to W2 60m

    W2 to W4 25mW4 to W3 170mW3 to W2 125mW1 to w4 90mNumber of computers ineach of the wing:

    W1 150W2 15W3 15W4 25

    Computers in each wing are networked but wings are not networked. The company has now decided to connect the wings also.

    i) Suggest a most suitable cable layout of the connection between the wings.ii) Suggest the most suitable wing to house the server of this company with a suitable reason.iii) Suggest the placement of the following devices with justification: 1) Router 2) Switch / Hubiv) The company is planning to link its head of fice situated in India with the of fices at Reliance. Suggest an economic way to

    connect it; the company is ready to compromise on the speed of connectivity. Justify your answer.(3)Short answer type quest ion: [2 or 3 marks for each]

    1) Which protocol is used to move Hyper Text document and simple file transferring through networks in wide area scale?2) Which protocol will you use to transfer a file from the remote location?

    3) Which transmission medium should be used to transfer data across two continents at very high speed?4) How can you increase to signals between two networks if it is going down?5) How the Indian languages are getting included in the application of computers easily? Name four such languages.6) How do the web address is practically used in the net? Write the format of the same.

    7) Is there any difference between an IP address (i.e. 239.004.994.010) and web address (i.e. www.indoaryan.org)?8) Arrange the followings in ascending order according to their data transmission rate.

    9) Sujata had some confusion between Domain name and URL. How do make her understand about the differences?10) Which of the following is not a characteristic of Open Source Software: (i) There is a company owner (ii) Can be

    downloaded freely (iii) Source code is available for modification.11) There is a group presentation of two professors with their Palm Tops connected through Bluetooth. Which of the

    following networks they are using: WAN LAN PAN MAN12) How do you differentiate the OSS and Proprietary software in terms of customizability of the software?13) Arrange the following communication channels in ascending order of their data transmission rates.ETHERNET

    CABLE, OPTICAL FIBER, TELEPHONE CABLE, COAXIAL CABLE.

    (g1) Suggest the cable layout of connections between the buildings.(g2) Suggest the most suitable place to house the server, with asuitable reason.

    (g3) Suggest the placement of the following devices with reasons :i) Repeater ii) Hub Switch

    (g4) The Institute is planning to l ink its International office situated inNew Delhi. Suggest the best wired communication link with a veryhigh speed connectivity from the following :

    i) Telephone Analog Line ii) Ethernet Cable iii) Optical Fiber

    http://www.indoaryan.org/http://www.indoaryan.org/http://www.indoaryan.org/
  • 7/24/2019 Ip Assignment 2014(1)

    4/14

    14) Which of the following softwares are open source: LINUX, MS WINDOWS 7, PHOTOSHOP, MYSQL

    (4)Define / Make a shor t note of the follow ings (OSS): [1-2 / 2-3 marks of each](a) Free software, (b) Open source software, (c) Freeware, (d) Shareware, (e) Source code, (f) FLOSS, (b) FSF, (h) W3C, (i)OSI, (j) GNU, (k) Tomcat, (l) MySQL, (m) Front-End & Back-End, (n) Pango, (o) PHP, (p) Open Office, (q) Python, (r)

    Firmware, (s) UNICODE (t) ASCII code (u) Name 2 sites of OSS.

    [ Question#2 ] Java (with IDE) + HTML & XML [TOTAL MARKS 10](1)

    a) Explain How and when do you use getText() & setText()methods?b) Differentiate of its applications: isEditable() &isEnabled()c) Write the use of valueOf()method and output of the statement: float x=999.101;jLabel1.setText(String.valueOf(x));

    d) Write the function of toString()method.e) What is a wrapper class? Explain the following in terms of wrapper class: String x=12345; int y=Integer.parseInt(x) ;f) Why do you use import javax.swing.JOptionPane? Describe the two applications of JOptionPane class of the package

    javax.swingg) Which swing components doesjavax.swing.JPanelcontainer contain?h) Write the application of the methodgetPassword()with a right example.

    i) How do you insert single lined and multiple lines comments?j) What are the members of Java Tokens?k) Differentiate: (a) Identifiers & Keywords , (b) Primitive & Reference Datatype , (c) Local & Instance(object) variable , (d)

    Logical & Relational operators, (e) \t & \n , (f) \b & \r , (g) / & % operatorsl) Differentiate: (i) int x=10 & final int y=10; (ii)(int k=10) & (int k==10)m) What is use of defaultin switch..case statement? When do you use breakin switch..case?

    n) What are pre and post increments? Can you explain pre & post decrement also with example?o) What will happen if you run a breakstatement in for loop? When do you use forloop?

    p) How do you differentiate the applications of: whileand dowhile statements?q) What are exit-controland entry-controllooping statements? Explain with example.

    r) In a Java application using Net Beans IDE, the user views the data on the Text Fields, he found thathis name ismisspelled, now he wants to edit it, but cant. What was done by the programmer that does not allow the user to edit hisname?

    s) How do you enable the jLabel1?t) How do you insert values into the TextArea? Write the syntax in terms of inputing value of i: for(i=1;i in t x = (5>=8) ? 1 : 2;aa)What is ButtonGroup? How does it effect to select a Radio Button?bb)How does the Model contain the data to be taken from a list of data?cc) What is the concept of OOP in terms of Class and Object? Write the syntax of the object creation.dd)Object of which class do you create when you are working with inheritance? Write the advantages of inheritance.

    ee)How many times the following loops will run? Which one of these is entry control and which one is exit control? Show theoutputs: (A) int s=0 ; i=4 ; do { s+=i ; i++ ; } while (i main.exe)

    ii) What is purpose of user defined method? How do you pass parameters/arguments to a method?jj) Explain methods call by value and call by reference.

    kk) When a called method is called as void type and other data types? What do you understand value returned?ll) Explain scope of variables in terms of Local and Global variables.

    mm) Write a function that will take length and breadth of a rectangle as parameters and return the area of the rectangle.nn) Write the use & Outp ut of th e fol lowin g STRING Library Funct ions:

    (1) contact( ) (2) Length( ) (3) substring( ) (4) toLowerCase() (5) toUpperCase()(6) Trim() (7) String x=Indoaryan ; String y=Existentialism ; x=x.contact(y) ; System.out.print( +x) ;

    oo) Write the use & Output of the fol lowing L ibrary Funct ions from MATH class:(1) Math.sqrt() (2) Math.abs() (3) Math.cell() (4) Math.pow() (5) Math.round() (6) Math.max()(7) Math.min() (8) Math.floor(12.7) (9) Math.pow(2,3) (10) Math.sin(30) (11) Math.round(78.678)

    pp)What is the use of newoperator during creation of an object (instantination) of a class?qq)What is a class? Explain the function of a constructor in a class?rr) How does an inherited class use the parent class?ss) How many kinds of Parent and Child class relationships can you mention?tt) How do private , public , protected & default accessibility of variables and methods of a class can work?uu)What is the use of an object? How do you call a method add() which is declared and defined in the child class?vv) Differentiate: Method-Overloading and Method-Overriding with examples.

  • 7/24/2019 Ip Assignment 2014(1)

    5/14

    ww) Radha created a method add() in a super class named myclass and she also made another method of the samename [ add() ] declared in the child class yourclassof myclass. But while she runs the program, method of the parent

    class does not run, but method of child class does run? What is the reason behind it? Can she run the method of the

    super class? If yes then how?xx) Satya created threemethods of the same name Calc_Val()in a class and called the three methods one by one with

    three different sets of parameters/arguments such as(int a) ; (int x, String k) & (double i, long j, char p). Will Satya get

    success to run these three methods consecutively? If so explain how?yy) What is an Abstract Class? How do you use it, explain with an example?zz) Explain the interfaceof class with an example.

    aaa) Rathin has created a class, has no instantiation of objects (no objects created) and there is a method created insidehas no implementation and terminated with a semicolon (;) just after it defined. Now how Rathin does fill the gap of not

    implementation of the method, by implementing the method in a sub-class (inherited) of the same?bbb) What is Front-End Back-End connectivity? Write the application of JDBC and ODBC in 3Gl-4GL connectivity?ccc) Write about JDBC-ODBC Bridge. What is JDBC Api?ddd) How does JDBC driver work for MySQL?

    eee) Write the statement (syntax) that makes driver loaded to establish connection between Java and MySQL?fff) Write the statement (syntax) that makes the connection between Java and MySQL?ggg) How can you run a SQL Command in a Java program, that is written for database connectivity?hhh) Give the functions of: getConnection() , getDriver() , getLoginTimeout() , executeQuery() , executeUpdate() , first()

    , previous() , getLong() , getRowCount() , setRowCount() , removeRow() .

    (2) Write the answer of the following based on HTML & XML:

    a) Write down the differences of HTML and XML.b) Write mail 2 advantages of XML over HTML.c) Expand the term HTML and its function. d) Which tag in HTML will Subroto use place his photograph in the back ground of his web page? How will he use it?

    e) What are the different four levels of HTML tags?f) What is the file extention of a HTML code to be saved in a word processor? What type of file does it create?g) What are the fundamental / document tags of HTML?

    h) What are container tag and empty tag? Explain with examples.i) Wrte the function of HEAD and TITLE tags.j) Write the different elements / attributes of BODY tag.k) Explain the function of the followings: BGCOLOR , BACKGROUND , TEXT , LINK , VLINK , ALINK

    l) Write the differences of LEFTMARGINE and TOPMARGINEm) Write the elements / attributes of FONT tag.n) Write the functions of: FACE , COLOR , SIZEo) What is BASEFONT?

    p) Differentiate between and tag?q) How do you use the following tags? Give suitable examples to explain: (i) commsent (ii) paragraph (iii) centerr) Explain the uses of the following HTML text tagswith example:

    s) (a)
    (b)

    (c) (d) (e) (f) (g) (h) (i)

    (j) (k) (l) (m) (n) (o) (p) (q) (r) , < INPUT TYPE=submit VALUE=Submit Order> , < INPUT TYPE=Text> ,

    t) How do you display H2SO4 & (A+B)2in a HTML page?

    u) What are the different levels of Heading tags? Give example.

    v) Which of the tags : or gives a bigger size heading?w) What is tag? Write the different elements/attributes of HR tag.x) What are uses of the followig in terms of HR tag: ALIGN , NOSHADE , WIDTH (in Number) , WIDTH (in %age).y) Answer the following in terms of LIST tags:

    (a) (b) (c) (d) (e) (f) (g) (h) z) What is the use of TYPE (A , a , I , i , 1 ) element in tag?aa) What is the use of START element in tag?bb) What are the different types of bulletes can be used in tag?

    cc) What is use of VALUE element in tag?dd) Explain with example nesting tag OR tags within tag?

    ee) What is the HTML code for the following outputs (the Hyperlinks are indus.html & agre.html):

    INDIA

    1. Economy

    Industry

    Agriculture

    2. Education

    INDIA

    3. Economy

    Industry

    Agriculture

    4. Education

    INDIA1. Economy

    Industry

    Agriculture

    INDIA1. Economy

    2. Education

    3. Health

    http://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/i.htmlhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/e.htmlhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/e.htmlhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/i.html
  • 7/24/2019 Ip Assignment 2014(1)

    6/14

  • 7/24/2019 Ip Assignment 2014(1)

    7/14

    (5)

    a. Title of the page should be Bharat

    Darshan

    b. Background colour should be Yellow

    c. Text font should be Dauphin

    d. Image of the Indian map from the file

    MapOfIndia.gif

    e. Pages are linked with :

    f. (a) Kerala Dekho as Keral.htm

    (b) Himachal Dekho as Him.htm

    (c) GOA Dekho as Goa.htm

    (d) Rajasthan Dekho as Raj.htm

    g. Visited link colour be Blue and

    h. Active link colour be Red

    i. Bottom message should be centre aligned and the font s ize as 2

    [Question# 3] RDBMS with MySQL [TOTAL MARKS 10](1) RDBMS:a) Define: (a) Relation, (b) Attribute or column, (c) Touple or row, (d) Field or Attribute

    (e) Degree, (f) Cardinality, (g) Entity. [1 - 2 marks for each]

    b) Difine: DDL , DCL , DML , TCL , Query command. [1X5]c) Define the following KEYs: FOREIGN KEY , PRIMARY KEY , CANDIDATE KEY , ALTERNATIVE KEY [1x4]

    d) Describe different 3 types (1-1 , 1-many , many-many) of data relationships. [3]e) With diagram describe the different components of Database. [3]f) What are problems of Data Redundancy and Data Inconsistency? [2]g) What is Cartesian Product? Give example. [1]

    h) Define Data Models: Relational , Network , Hierarchical , Object Oriented [3X2]i) What will be value of the cardinality if you add 3 rows to a table of existing 5 records? [1]j) Draw and explain the relationship of: (a) One-to-one, (b) One-to-many, (b) Many-to-many. [2]k) What is client-server system? Explain 2-tyre and 3-tyre system. [2]l) In a query what is the use of _ _a% ? [1]

    m) How do you create a Foreign Key (REGNO) in table (CLASS) to make relationship with a Master/Parent table

    (STUDENT)? Also write the basic factors to select a field as the Key field (Primary/Foreign). [2]n) Write the use of these constraints: NOT NULL , UNIQUE , CHEQUE , PRIMARY KEY , DEFAULT [2]

    o) What is joining of tables, write itstypes? What is Alias using queries on multiple tables? Give example. [3]p) Write the uses of GROUP BY and ORDER BY clauses. [2]q) How can you restrict user to enter duplicate values in a field?r) Differentiate: (i) ALTER & UPDATE tables [2]

    s) Differentiate: (i) Equi Join & Non-Equi Join [2X2]t) Define: COMMIT ROLLBACK SAVEPOINT [3]u) What is group function? Give two examples.v) How do you make any change permanent in Database?

    w) Differentiate the uses of: DROP & DELETE.2. Write the USE an d OUTPUT of the follow ing library fun ctio ns (STRING , ARTH IMETICAL , DATE):

    A. (i) CONCAT() (ii) INSTR() (iii) SUBSTR() (iv) LEFT() (v) RIGHT() (vi) TRIM() (vii) LTRIM() / RTRIM()B. (i) ROUND() (ii) POWER() / POW() (iii) TRUNCATE()

    C. (i) DATE() (ii) CURDATE() (iii) NOW() (iv) YEAR() (v) DAYOFMONTH() (vi) MONTHNAME() (vii) MONTH()(viii) DAYNAME() (ix) SYSDATE()

    [Question# 4] Java (with IDE) [TOTAL MARKS 15]

    (1)NDPS offers two crash courses, one

    in computers and the other inCommerce. The students can avail

    certain optional facilities. The BasicInterface for accepting details of facilitiesavailed by a student are as given under:Write the code and event methods for

    incorporating the following functionality:

    Assume that the charges for library,mess and Transport are Rs. 500,Rs.1200 and Rs. 1000 respectively.

    Write a method that calculates (inButtonCalc) the charges per session (3months), for the facilities availedincluding registration fees Rs.500. Let

    course fees for MCA and MBA per

    BBhhaarraattDDaarrsshhaann

    Kerala Dekho

    Himachal Dekho

    GOA Dekho

    Rajasthan Dekho

    Create your email ID on: www.theindianschoolonline.com

    http://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/xhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/xhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/xhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/xhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/xhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/xhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/xhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/xhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/xhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/xhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/xhttp://localhost/var/www/apps/conversion/tmp/scratch_4/IP2011/x
  • 7/24/2019 Ip Assignment 2014(1)

    8/14

    session are: 15000 and 20000 respectively. [4]

    (2)Read th e fol lowin gcase stud y and answer the quest ions that fol low:ABC company has developed the following interface to enter the display data related to Income tax of employees. When theform loads text boxes for income tax, Education tax , surcharge and total tax amount should be disabled. They should be

    enabled only when calculatecommand button is clicked. [2]

    When the user clicks the clearcommand button textboxesempcode and empname should be

    set of blank and textboxes be setto zero. [2]

    When calculate command buttonis clicked income tax, educationaltax, surcharge and total tax (sumof income tax, education tax ,

    surcharge) is displayed in theirrespective text fields based on thefollowing criterion :- [4]

    (3) Here is a Students Entry Form. Here a student

    shall enter his/her name and select sex, game andbranch andsubmit theselected

    data. Nowanswer thefollowingquestions

    using thecontrolnames:(a) Write

    the codefor theEXITbutton to

    stoprunningthe application. [1]

    (b) Write the code for SUBMIT button to take the values from different options and store 3 points to a variable pt if selected

    sex is Female and branch is Humanities. [4]

    (4) Write the Java program as instructed below:A Financer often needs to calculate the interest and

    amount of his clients. He assigned his software

    programmer to design a calculator which will

    calculate the compound interest and amount due if a

    person takes loan for 5,10 or 15 years. The

    programmer opts for Net Beans IDE with Java to

    develop the following form as the layout given:

    Taxable income Income tax Education tax Surcharge

    Upto Rs. 100000 Nil Nil Nil

    Rs. 100001 to 150000 10% of amount exceeding Rs. 100000 2% of taxable income Nil

    Rs. 150001 to 250000 Rs. 5000 + 20% of amount exceeding Rs. 150000 2% of taxable income Nil

    Rs 250001 and above Rs. 25000 + 20% of amount exceeding Rs. 250000 2% of taxable income 1% of taxable income

    Controls Name

    jTextField TextName

    jCheckBox ChkBsktChkFootChkSwim

    ChkHokyjRadioButton RadioBoy

    RadioGirl

    jComboBox CmbBranch

    jButton ButtonSubmitButtonExit

  • 7/24/2019 Ip Assignment 2014(1)

    9/14

    (a) Write the code to disable the textInterest in the Form Load event of

    frmInterestCalc. [1]

    (b) Write the code for cmdClear Command Button to clear all the text boxes.

    And set default choice in the Option Button as 5 Years. Also put the cursor

    to the txtPrincipal. [2]

    (c) Write the code for the text boxes for the Principal and Rate entry to ensure

    that the user enters only numeric values in them.

    (d) Write the code for the click event of the command button to calculate the

    compound interest and amount depending on the principal, rate and time.

    [Compound Interest=> P * (1+r/100)^T Amount=> Principal + Compound Interest]

    (5)

    Ms. Sheela works in a shopping mall. To calculate net payable amount she has developed the following GUI in NetBeans. Theshop accepts payments in three modes- Cash, Debit Card, Credit Cards. The discount given as per mode of payment is asfollows- If the Member check box is checked then the customer gets an additional discount of 5% on net payable amount.

    I. Write the code to make the textfields for Discount( txtDiscount ) and Net Payable (txtNetPayable) un-editable.II. Write code to do the following-

    a) When Calculate button is clicked the discountand net payable amount is calculated as perthe given criteria and displayed in discountand net payable text boxes.

    b) When Clear button is clicked all the text boxesshould be clear.

    c) Close the application when Exit button ispressed.

    (6) RE-WRITE THE PROGRAMS WITH CONVERSIONS:

    a.Rewrite the following code segment using switch case

    instead of if else: [3]

    int sal ;if (sal =12000) && (sal 20000)System.out.print(New year bonus is 7000);

    elseSystem.out.print(Bonus not applicable);

    b.Convert the following without using a for loop: [3]

    for( int j = 3; j>=1; j--)

    {if (x==1)System.out.print (One);

    else if (x==2)System.out.print (Two);else if (x==3)System.out.print (Three);

    }

    c.Convert the following into a FOR loop: [3]

    int i=99;do { System.out.println(+i+10) ;

    i=i-3;}

    while (i

  • 7/24/2019 Ip Assignment 2014(1)

    10/14

    g. Rewrite following for loop into a while loop

    int sum=0;

    for(int i =1;i=0

    If(x>=y){ x=x-y;

    return compute(x,y) ; }else{ return x;}

    }

    (b) int x,y;

    for(x=1;x

  • 7/24/2019 Ip Assignment 2014(1)

    11/14

    (g) int x=0;for(i=1; ii ; j--)

    {System.put.print(The j is + j)

    System.out.display(The i is + i);}X=i+j;

    System.out.print(The x is + x) }

    (h) int i=0;x=0;while ( i < 10 )

    {if (i % 2 = 0)

    { x == x + i ;

    System.out.print(x + 1);}i ++;

    }

    (9) WRITE PROGRAM IN Java using Net Beans IDE: [Marks 3 / 4 each]a) Write a method that calculates the sum of all even numbers less that Nb) Write a method that takes an integer argument N and calculates the sum of all even numbers less that Nc) Write a method that takes 2 integer arguments N & A and returns the sum of powers of A up to Nth term.[S=A1+A 2++ ANth term]d) Write a method in a class (myclass) that takes integer values of N and A and return the sum of the powers of A up to Nth

    term.[S=A1+A

    2++ A

    Nth. term ]

    e) Write a method in a sub-class (yourclass) of the super class myclass that takes an integer value of N from the user and

    calculates the sum of the odd numbers up to Nth term.f) Write a method in a child-class (yourclass) of parent class myclass that takes integer arguments/parameter of N from the

    caller method sum() through the object myobj, and return the sum of the odd numbers up to N and display the result.g) Write a method (sum()) in a class myclass and pass object(myobj) of the class as argument/parameter from the caller

    method , and return the sum of the odd numbers up to Nth term and display it after the caller method called.h) Write a method pere()in a class which will take 2 parameters Length & Breadth as referencethrough object and find area.

    i) Write a program to store your name into an Array and display character wise reading from the Array.j) Write a program to store natural numbers into a double dimension Array and print the sum of the numbers row wise.k) Write a method will take New value and position as parameter, which are of integer type, insert the new value in the

    specified position in an array.

    (l) Write a function Power to raise a number m to power n. The function takes two integer value and returns the resultcorrectly, Use default value of 2 for n (to calculate squares) if argument is omitted. [3]

    (m) A class Electbillcontains consumer details and another class Billcalculates the monthly electricity bill of a consumer.

    Details of the two classes are given below:

    Class name : ElectbillData members/ Instance variable :

    cno : consumer numbername : consumer name

    add : consumer addressMember functions:

    Electbill(....) : Parameterised constructor to assign values to consumer number, consumer name and addressvoid display() : Display consumers details

    Class name : BillData members/Instance variable :

    n : integer variable to store number of the units consumedMember functions :

    Billl(....) : Parameterised constructor to assign values to data membersvoid calculate() :Calculate the monthly bill of consumer according to following slabs and it should also display theconsumers details and total amount to be paid.

    Number of units consumed Rate

    1 - 100 Rs 500/-rental charges only

    101 - 200 Rs 1.00 per call + rental charges

    201 - 300 Rs 1.20 per call + rental charges

    Above 300 Rs 1.50 per call + rental charges(n) Specify the class Electbill giving details of constructor and member function void display().Using the concept of

    Inheritance specify the class Bill giving details of constructor and member function void calculate()(o) Write the programs of the following outputs:

    (i) #

    # #

    # # #

    (ii) * * *

    * *

    *

    (iii) @@ @ @

    @ @ @ @ @

    (iv) 12 2 2

    3 3 3 3 32 2 2

    1

  • 7/24/2019 Ip Assignment 2014(1)

    12/14

    [Question# 5 & 6] RDBMS with MySQL [20]

    (1) Write the SQL commands of the following Table(s) [0.5 mark of each qs.]

    Table: STUDENT

    Table : CLASS

    (10.1)

    a) Create the table Student, using constraints NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, CHEQUE, DEFAULTvalue RANCHI for Address in appropriate attributes/fields/columns.

    b) Enter a new record: S009, Swapan Pal, 11, E, 80.5, 15-8-1991.c) Re-arrange the records in descending and ascending order on Date of Birth.d) Display the Name Class Age and Date Of Birth of the students who have either less then 80 Average Marks, or year of

    birth before 1993.e) Display the Name, Admission number and Date of Birth of those whose first character of name is K.f) Display the Name, Admission number and Date of Birth of those where 7

    thlatter of the address is A.

    g) Display the Different Sections present in the table.h) Display the Different Sections and their corresponding numbers present in the table.

    i) Replace the Name Ajay Malhotra by Ajit Mahapatra. j) Increase each of the Average Mark by 2.0.

    k) Display number of records present in the table.l) Display Numbers of each section in the table of those who got Average Marks more than 75.

    m) Include a new column Address in the table.n) Delete the same column.o) Make the column Admission number as a Primary Key.p) Remove the existing record(s) of all who are not from classes 11 or 12.

    q) Display the Maximum Average Marks from each section.r) Display the Minimum Average Marks from each section.s) Display the Total Average Marks of the table.t) Display the values of Name and Date of Birth close together (concatinate).

    u) Show the Name and number of characters of each name.v) Show the first character of each name as Capital.w) Show the each of the names in capitals and small as well separately.x) Locate position of the character Ain each of the name.

    y) Display rest of the blank characters of a described field by* .

    z) Remove all of the blank spaces from name field.aa) Display first 5 characters of each of the name.

    bb) Convert the date value into character value and number value of year of birth after 1990.cc) Find the Square root and Reminder of division by 3 of Average marks.dd) Display the Power 3 of the Average Marks of the sections A.

    ee) Make StdCode of the Student table as FOREIGN KEY in reference to the Parent table Teacher.

    ff) Display Students Code , Name , Address , Average Marks , Date of Admission of the tables Teacher and Student. gg) Display Name , Date of Admission , Date of Birth from the tables Student and Class using Allies of the Tables.hh) Write commands to: (i) DROP the common field STDCODE of Class table. (ii) Now display Name, Date of Admission,

    Average Marks and Address from the both of the tables Teacher & Student. (iii) Again ADDthe column Dropped before.

    (10.2)

    a) Display Name, Class, Address and Date of Admission from tables STUDENT and CLASS have similar student code.b) Display allthe Sections and Date of Birth from above two tables.

    c) Create a view MyClass using the columns Name, DOB, and AvgMark from Student.

    (10.3) Write the OUTPUT of the following commands from the above table Student.a) SELECT Name from STUDENT where AvgMark > (SELECT AvgMark from STUDENT where Class=11);b) SELECT X.Name, X.Roll, Y.Address From STUDENT X, STUDENT Y where X.AdmNo=Y.AdmNo;c) SELECT Addres from CLASS where Section IN (SELECT Section from STUDENT where Class>=11);

    d) SELECT Count(*), DISTINCT(Section) from CLASS;

    e) SELECT Count(*), Section from STUDENT Group By Section Having Class>=10;

    f) SELECT (AvgMark *0.5 from STUDENT where Name like S%;

    STDCODE NAME CLASS SECTION AVGMARK DOB

    S009 AJAY MALHOTRA 11 A 86.55 12-DEC-1995

    S010 KUSUM VIMANI 12 C 79.85 22-MAR-1994

    S012 SARITA VERMA 12 C 98 23-JAN-1992

    S015 KAILASH SINGH 10 D 78.45 5-OCT-1993

    S020 SANJAY SRIVASTAVA 11 K 85.45 10-MAY-1990S033 KAVITA SAXSENA 9 K 66.50 12-SEPT-1993

    S052 BIJAY MAJUMDAR 12 B 88 5-NOV-1989

    STDCODE SECTION ADDRESS DOA

    S009 A RANCHI 12-MAR-2001

    S010 C PATNA 20-MAR-1999

    S012 C TATA 13-FEB-2000

    S013 D DHANBAD 15-JULY-1999

    S022 L KOLKATA 10-MAR-2002

    S033 K SILLIGURI 5-MAY-2004

    S052 B BHUBANESWER 15-DEC-2003

  • 7/24/2019 Ip Assignment 2014(1)

    13/14

    g) SELECT MIN (AvgMark) from STUDENT; (g.1) SELECT MAX (AvgMark) from STUDENT;h) SELECT SUM (AvgMark) from STUDENT where DOB > 1990-12-13 AND DOB < 1995-1-1;i) SELECT StdCode, Section from Student UNIONSELECT StdCode, Section from Class;

    j) UPDATE Class Set Address=Ranchi Where StdCode=(Select StdCode From Student Where DOB=1993-10-15);NB: You must also go through the Solved Ex ercises of the chapter Review o f SQL .

    11.Answer the questions based on the table HOSPITAL given below: [16X1=16] Table: HOSPITAL

    Column Name Data type Size Constraint

    Ptnt_NoPtnt_Name

    Dept

    Doc_NameDt_BirthFees

    Ptnt_Phno

    NumberVarchar2

    Varchar2

    Varchar2DateNumber

    Number

    415

    15

    15---

    6,2

    12

    Primary KeyNot Null

    -----

    Not Null-----

    Default 00.00

    Check

  • 7/24/2019 Ip Assignment 2014(1)

    14/14

    The laws of total development of individual and society are Concentricity, Self elevation and

    Eugenics i.e. Ideal centric go-of-life, Accordingly self-manipulation and Bio-psychic compatible

    marriage; lets uphold it

    Hope we will be in touch for longer time, from any corner of the globe, I do wish - be a person with your evolving qualities andefficiencies for your greater surroundings. Yours own foreverS.M.

    Developed and Designed by:

    Dr. Srikumar Mukherjee, Dept. of Computers, Delhi Public School, Ranchi

    Email: [email protected] / [email protected]

    Ph # +91-9470932544 / 909753620 (Mob)

    To upgrade the quality of thought do visit:

    www.indoaryan.org

    COLLECT the Quest ion and Answ er papers of Sem-II and Pre-Boar d Exams and critically read and

    understand it ; which were already distributed to you. For further you are free to contact...

    mailto:[email protected]:[email protected]:[email protected]:[email protected]://www.indoaryan.org/http://www.indoaryan.org/mailto:[email protected]:[email protected]