model_question_paper_mi0032.pdf

Upload: mcajava

Post on 03-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    1/15

    1 | P a g e

    Sikkim Manipal UniversityModel Question Paper

    Subject: Java and Web Design Subject code: MI0032

    Total Time: 2 hours Total Marks: 140

    Notes:1. Question paper is divided into three parts i.e. Part A, Part B, and Part C.2. Part A consist 40 questions of one mark each3. Part B consist 20 questions of 2 marks each.4. Part C consist 15 questions of 4 marks each.

    5. All questions are compulsory

    Part A (One Mark Question)

    1. Java hasa. Only compilerb. Only interpreterc. Compiler and interpreterd. No compiler or interpreter

    2. Java is platforma. Dependentb. Independentc. Partially dependentd. Dependent with specific hardware

    3. Java is platform independent. Here platform meansa. Computer Systemb. Operating Systemc. Software available in the computerd. Hardware available

    4. The keywords in Javaa. Can be used as variable nameb. Can be used as constant namec. Cannot be used in different meaningd. Can be created by programmer

    5. In java & is thea. Logical operatorb. Relational operatorc. Conditional operatord. Comparison operator

    6. What is the result of the expression : 2 % -5a. 2

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    2/15

    2 | P a g e

    b. -2c. 0d. 5

    7. Break statement is used in Javaa. To break from current loopb. To break from all loopsc. To break from functiond. To break from program

    8. irrespective of condition , dowhile loop will executea. at least 2 timesb. at least 1 timesc. at least 3 timesd. infinite times

    9. Which is the java file compilation commanda. Java b. Javac c. Java compile d. Java cc

    10.Java uses some built-in class to communicate with system.a. Objectb. Systemc. Threadd. None of the above

    11.Inheritance helps you toa. Reduce redundancy in codeb. Reduce efficiency in applicationc. Reduce function accessing speedd. Reduce memory space

    12.To inherit class which keyword is musta. privateb. inheritc. extendd. public

    13.Which one is not the access specifiera. Publicb. classc. privated. protected

    14.Which class is used as a base class to derive specific classes of the same kinda. Abstractb. User defined

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    3/15

    3 | P a g e

    c. Derivedd. Expanded

    15.Exception is thea. Compile time errorb. Runtime errorc. System errord. Hardware error

    16.Exception occurs due toa. Coding problemb. Execution problemc. Logic problemd. Hardware problem

    17.The exception can be found ina. try blockb. catch blockc. throw blockd. main block

    18.The catch method can bea. Overloaded number of timesb. Cannot be overloadedc. it can be overloaded but not more than two timesd. Overloading depends upon the try block

    19.Pick the correct statementa. try block is mandatory for java programb.

    catch is mandatory if try block is present in the program

    c. finally block is mandatory in java programd. try , catch and finally all are mandatory in any java program

    20.ArrayIndexOutOfBounds exception occurs only whena. Array type mismatchingb. Looping problem is there in the programc. Array index exits the boundaryd. Array element content large value

    21.Applet is aa. Java program that can be embedded in a web pageb. Java program that cannot be embedded in a web pagec. core Java programd. not linked with any java code

    22.For testing java applet program we are usinga. Java Viewer

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    4/15

    4 | P a g e

    b. Program Viewerc. System Viewerd. Applet Viewer

    23.java.applet package is available ina. AWTb. APIc. AWKd. RMI

    24.What tag is used for applet codea. . b. c. ..d. ..

    25.The applet life cycle has four methods init(), start(), stop () anda. construct()b. delete()c. destroy()d. first()

    26.AWT stands fora. Abstract Window Toolkitb. Abstract With Toolkitc. Abstract Windows Toolsd. Application With Teaching

    27.Multithreading programming can be supported bya. Language Cb. Language C++c. BASICd. Java

    28.Threading meansa. Execution of loops like for, while etcb. Execution of number of block simultaneouslyc. Execution of number of functions simultaneouslyd. Execution of number of programs

    29.Pick the correct statementa. Java has no priority in its threadsb. Java has priority in its threadsc. Java can run only one threads in a programd. Java can run only two threads in a program

    30.The speed of execution of threads depends on

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    5/15

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    6/15

    6 | P a g e

    38.Comments in HTMLa. Cannot be doneb. can be done by the tag c. can be done by the d. can be done by the < comment >

    39.hyperlink can be done in HTML bya. b. c. d.

    40.Frame can be createda. At any position of the pageb. Only top of the pagec. Middle of the paged. Bottom of the page

    Part B (Two Mark Question)

    41.Java Bytecode isa. Occurred after compilationb. Occurred after interpretationc. Occurred after run or executed. Occurred after saving the program in text pad

    42.Primitive data type meansa. Special data type available in Java onlyb. Common data type which is built-in in java compilerc. User defined data typed. Mixture of user defined data type and common data type

    43.Abstract data type is required becausea. Built-in data type cannot solve some problemb. Built-in data type can solve the datac. Built-in data type cannot be used in javad. Built-in data type is not more flexible

    44.The main function must bea. Under any classb. Under the start up classc. Under another functiond. Under structure only

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    7/15

    7 | P a g e

    45.What is the value of the following expression : i+=i++ + ++i; if the initial value of i =2a. i=10b. i=12c. i=14d. i=16

    46.In the switch statementa. Break is compulsoryb. Continue is compulsoryc. We can put one more switch statementd. For loop is mandatory in switch

    47.The following expression: for (9) { .. }a. This is the looping expression which will execute infinite timesb. This is the looping expression which will execute 9 timesc. This is the looping expression which will execute 1 timed. This is the looping expression which will execute 0 time

    48.The function getChars() is used toa. This is used to extract only one characterb. This is used to extract more than one charactersc. This is used to extract number onlyd. This is used to change the character only.

    49.Packages are used fora. multiple use of member function onlyb. single use of program codec. multiple use class structure and their member functionsd. multiple use of program code

    50.Different package and non sub class can access onlya. Public membersb. Public membersc. Protected membersd. No modifier members

    51.CLASSPATH is aa. Environment variableb. User defined variablec. Static variabled. Dynamic variable

    52.What is the output of the following program codeclass erithmitic_exception

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    8/15

    8 | P a g e

    {

    public static void main(String args[]){

    int a=5,b=10,c;

    try{

    c=a/b;

    System.out.println("RESULT IS ="+c);}

    catch(ArithmeticException e)

    {

    System.out.println("Division by ZERO Error");}

    System.out.println("End of Program");

    }

    }

    a. RESULT IS =0End of Program

    b. RESULT IS = 1End of Program

    c. RESULT IS = 0Division by ZERO Error

    End of Program

    d. RESULT IS = 1Division by ZERO Error

    End of Program53.finally block is used to

    a. execute some optional expressionb. execute the compulsory expression after try and catchc. execute the expression if the control enters into the catch blockd. execute the expression which has no compilation errors

    54.The Null Exception occursa. When an application attempts to use null where an object is requiredb. When an application attempts to use null pointer onlyc. When an application does not have null pointerd. When an application attempts to use null program

    55.In which packages of java, Exception classes are availablea. Java.langb. Java.ioc. Java.exceptions

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    9/15

    9 | P a g e

    d. Java.applet56.Please read the program code and what will be the output.

    e. BaseballCricketCricketf. BaseballFootballFootballg. BaseballCricketFootballh. BaseballFootballFootball

    57.What is the output of the following code

    var myString = "9379011815";

    var length = myString.length;

    document.write("The string is this long: " + length);

    // Same thing, but using the property inside the write function

    document.write("
    The string is this long: " + myString.length);

    a. The string is this long: 6b. The string is this long: 10c. The string is this long: 9d. The string is this long: 91

    58.What is the output of the following code

    var myString = "123456";

    document.write("The string is this long: " + myString.length);

    myString = myString + "0007890";

    document.write("
    The string is now this long: " + myString.length);

    a. The string is this long: 6The string is now this long: 7

    b. The string is this long: 6

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    10/15

    10 | P a g e

    The string is now this long: 10

    c. The string is this long: 7The string is now this long: 10

    d. The string is this long: 8The string is now this long: 10

    59.What will be the output of the following code

    var aURL = "http://www.tizag.com/www.html";

    var aPosition = aURL.indexOf("www");

    var secondPos = aURL.indexOf("www", aPosition + 1);

    document.write("The position of www = " + aPosition);

    document.write("
    The position of the second www = " + secondPos);

    i. The position of www = 7The position of the second www = 21

    ii. The position of www = 3The position of the second www = 24

    iii. The position of www = 6The position of the second www = 21

    iv. The position of www = 8The position of the second www = 22

    60.In datagram-based communication such as UDP, the datagram packet contains the portnumber of its destination and UDP routes the packet to the appropriate application theports are represented

    a. 8-bit numbersb. 16-bit numbersc. 32- bit numbersd. 64- bit numbers

    Part C (Four Mark Question)

    61.What are the steps to run java programa. Code compilerunb. Code interpret compile runc. Code compile interpret rund. Code run interpret compile

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    11/15

    11 | P a g e

    62.Identified the correct statementa. System.out.print() in Java and scanf() in C are almost similarb. System.out.println() in Java and printf() in C are almost similarc. System.out.println() in Java and PRINT in BASICd. System.out.println() in Java and c.out in UNIX

    63.What is the value of ch after the following expression :char ch;

    ch = "Computer Centre".charAt(12);

    i. nj. tk. el. C

    64.What is the output of the following expressionString S1=Computer, S2=Conputer

    S2.equels(S1);

    a. Trueb. Falsec. 0d. 1

    65.What is the value of S1 after execution of the following expression :String S1 = "Independence".replace('e', 'X');

    a. S1=Independenceb. S1=IndXpXndXncXc. S1=IndXpendenced. S1=XXXXXXXXXXXX

    66.What is the output of the following codeclass A

    {

    public static void main(String args[])

    {

    try{

    System.out.print(I am a );

    }

    catch(Exception e)

    {

    System.out.print(good boy);

    }

    finally{

    System.out.print( bad boy)

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    12/15

    12 | P a g e

    }

    }

    }

    a. I am a good boyb. I am a good boy bad boyc. I am a bad boyd. I am a

    67.What is the output of the given program codeimport java.io.*;

    class float_addition

    {

    public static void main(String args[]) throws IOException

    {

    BufferedReader obj = new BufferedReader(new

    InputStreamReader(System.in));

    float a,b,c;

    System.out.print("Enter 1st Value ");

    a=Float.parseFloat(obj.readLine());

    System.out.print("Enter 2nd Value ");

    b=Float.parseFloat(obj.readLine());

    c=a+b;

    System.out.println("Sum is = " +c);

    }

    }a. It shows exception errors if data type mismatch is there otherwise adds two

    floating point numbers

    b. It will show the errors onlyc. It will add any two numbers irrespective of data typesd. It will add any two double precession numbers

    68.Find the correct outputimport java.io.*;

    import java.lang.*;

    class input_string_buffer

    {

    public static void main(String args[])

    {

    StringBuffer obj =new StringBuffer("Arindam Ray");

    obj.setCharAt(9,'o');

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    13/15

    13 | P a g e

    System.out.print("the output is " + obj);

    }

    }

    a. Arindam Rayb. Arindam Royc. Arindom Rayd. Arindom Roy

    69.What is the output of the following codeimport java.awt.*;

    import java.applet.*;

    public class Test extends Applet

    {

    int initcounter=0;int startcounter=0;

    int stopcounter=0;int destroycounter=0;

    public void init(){ initcounter++; repaint (); }

    public void start()

    { startcounter++; repaint (); }

    public void stop(){ stopcounter++; repaint ();}public void destroy()

    { destroycounter++; repaint ();}

    public void paint (Graphics g)

    {

    g.drawString ("init has been invoked " + String.valueOf(initcounter)+"times",20,20);

    }

    }

    m. init has been invoked 1 timesn. init has been invoked 2 timeso. init has been invoked 3 timesp. init has been invoked 4 times

    70.User interface in Applet consist with three components, which area. Components, Containers and LayoutManagersb. Frames , Containers and LayoutManagers

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    14/15

    14 | P a g e

    c. Frames, Constants and LayoutManagersd. Components, Frames and LayoutManagers

    71.The Adaptor class in java is used toa. implement corresponding listener interfaces containing more than one methodb. implement the general classes as interfacec. implement the class as private classd. protect the all members

    72.Read the process of thread and pick the correct statement

    a. After Idle thread it goes to dead blockb. After resume the process from Blocked Thread it goes o running queue in the

    Active Thread

    c. After resume the process from Blocked Thread it goes o runable queue in theActive Thread

    d. The method stop () always move the control to New Born State.73.The application of thread is

    a. Task of memoryb. Task of operating systemc. Task of hard diskd. Task of software

  • 7/28/2019 Model_Question_Paper_MI0032.pdf

    15/15

    15 | P a g e

    74.The out put of the threada. Is fixed for every timeb. Is not fixed for every timec. Cannot be predictedd. Infinite result will come

    75.Pick the correct statementif (args.length != 1) {

    System.out.println("Usage: java QuoteClient ");

    return;

    }

    a. Args.length is the command line argumentb. Args.lenght is the argument which will appear at the exceptionc. Args.length is the argument which will appear at the function loopd. Arg.length is the argument which will appear at the function name

    ------------------------------------------