Você está na página 1de 15

Sikkim Manipal University

Model 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 each 3. 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 has a. Only compiler b. Only interpreter c. Compiler and interpreter d. No compiler or interpreter 2. Java is platform a. Dependent b. Independent c. Partially dependent d. Dependent with specific hardware 3. Java is platform independent. Here platform means a. Computer System b. Operating System c. Software available in the computer d. Hardware available 4. The keywords in Java a. Can be used as variable name b. Can be used as constant name c. Cannot be used in different meaning d. Can be created by programmer 5. In java & is the a. Logical operator b. Relational operator c. Conditional operator d. Comparison operator 6. What is the result of the expression : 2 % -5 a. 2 1|Page

b. -2 c. 0 d. 5 7. Break statement is used in Java a. To break from current loop b. To break from all loops c. To break from function d. To break from program 8. irrespective of condition , do while loop will execute a. at least 2 times b. at least 1 times c. at least 3 times d. infinite times 9. Which is the java file compilation command a. Java <filename.java> b. Javac <filename.java> c. Java compile <filename.java> d. Java cc <filename.java> 10. Java uses some built-in class to communicate with system. a. Object b. System c. Thread d. None of the above 11. Inheritance helps you to a. Reduce redundancy in code b. Reduce efficiency in application c. Reduce function accessing speed d. Reduce memory space 12. To inherit class which keyword is must a. private b. inherit c. extend d. public 13. Which one is not the access specifier a. Public b. class c. private d. protected 14. Which class is used as a base class to derive specific classes of the same kind a. Abstract b. User defined 2|Page

c. Derived d. Expanded 15. Exception is the a. Compile time error b. Runtime error c. System error d. Hardware error 16. Exception occurs due to a. Coding problem b. Execution problem c. Logic problem d. Hardware problem 17. The exception can be found in a. try block b. catch block c. throw block d. main block 18. The catch method can be a. Overloaded number of times b. Cannot be overloaded c. it can be overloaded but not more than two times d. Overloading depends upon the try block 19. Pick the correct statement a. try block is mandatory for java program b. catch is mandatory if try block is present in the program c. finally block is mandatory in java program d. try , catch and finally all are mandatory in any java program 20. ArrayIndexOutOfBounds exception occurs only when a. Array type mismatching b. Looping problem is there in the program c. Array index exits the boundary d. Array element content large value 21. Applet is a a. Java program that can be embedded in a web page b. Java program that cannot be embedded in a web page c. core Java program d. not linked with any java code 22. For testing java applet program we are using a. Java Viewer 3|Page

b. Program Viewer c. System Viewer d. Applet Viewer 23. java.applet package is available in a. AWT b. API c. AWK d. RMI 24. What tag is used for applet code a. <APPLET> . </APPLET> b. <HTML> </HTML> c. <JAVA> ..</JAVA> d. <UL>..</UL> 25. The applet life cycle has four methods init(), start(), stop () and a. construct() b. delete() c. destroy() d. first() 26. AWT stands for a. Abstract Window Toolkit b. Abstract With Toolkit c. Abstract Windows Tools d. Application With Teaching 27. Multithreading programming can be supported by a. Language C b. Language C++ c. BASIC d. Java 28. Threading means a. Execution of loops like for, while etc b. Execution of number of block simultaneously c. Execution of number of functions simultaneously d. Execution of number of programs 29. Pick the correct statement a. Java has no priority in its threads b. Java has priority in its threads c. Java can run only one threads in a program d. Java can run only two threads in a program 30. The speed of execution of threads depends on 4|Page

a. CPU cycle of the system b. Memory speed of the System c. HDD speed of the system d. Independent of the System 31. The method wait() is used a. To control waits for some time being b. To control stops the process c. To control functions d. To control class only 32. Thread.sleep(500); expression is used a. To hold the control for 500 minutes b. To hold the control for 500 seconds c. To hold the control for 500 milliseconds d. To hold the control for 500 nanoseconds 33. InputStream Class Hierarchy has a. Three major classification b. Four major classification c. Five major classification d. Six major classification 34. ObjectOutputStream is under a. Output stream b. Input stream c. Buffered stream d. Number stream 35. To create random file by the following method a. RandomAccessFile (String mode, String pathname); b. RandomAccessFile (String pathname, String mode); c. RandomFileAccess (String pathname, String mode); d. RandomFileAccess (String mode, String pathname); 36. HTML is short for a. Hypor Text Markup Language b. Hyper Text Makeup Language c. Hyper Text Markup Language d. Hyper Text Mark Language 37. The first tag in your HTML document is a. <html> b. <body> c. <head> d. <title> 5|Page

38. Comments in HTML a. Cannot be done b. 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 by a. <a href > b. <a hiperlink> c. <a weblink> d. <a herf> 40. Frame can be created a. At any position of the page b. Only top of the page c. Middle of the page d. Bottom of the page Part B (Two Mark Question)

41. Java Bytecode is a. Occurred after compilation b. Occurred after interpretation c. Occurred after run or execute d. Occurred after saving the program in text pad 42. Primitive data type means a. Special data type available in Java only b. Common data type which is built-in in java compiler c. User defined data type d. Mixture of user defined data type and common data type 43. Abstract data type is required because a. Built-in data type cannot solve some problem b. Built-in data type can solve the data c. Built-in data type cannot be used in java d. Built-in data type is not more flexible 44. The main function must be a. Under any class b. Under the start up class c. Under another function d. Under structure only 6|Page

45. What is the value of the following expression : i+=i++ + ++i; if the initial value of i =2 a. i=10 b. i=12 c. i=14 d. i=16 46. In the switch statement a. Break is compulsory b. Continue is compulsory c. We can put one more switch statement d. For loop is mandatory in switch 47. The following expression: for (9) { .. } a. This is the looping expression which will execute infinite times b. This is the looping expression which will execute 9 times c. This is the looping expression which will execute 1 time d. This is the looping expression which will execute 0 time 48. The function getChars() is used to a. This is used to extract only one character b. This is used to extract more than one characters c. This is used to extract number only d. This is used to change the character only. 49. Packages are used for a. multiple use of member function only b. single use of program code c. multiple use class structure and their member functions d. multiple use of program code 50. Different package and non sub class can access only a. Public members b. Public members c. Protected members d. No modifier members 51. CLASSPATH is a a. Environment variable b. User defined variable c. Static variable d. Dynamic variable 52. What is the output of the following program code class erithmitic_exception 7|Page

{ 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 =0 End of Program b. RESULT IS = 1 End of Program c. RESULT IS = 0 Division by ZERO Error End of Program d. RESULT IS = 1 Division by ZERO Error End of Program 53. finally block is used to a. execute some optional expression b. execute the compulsory expression after try and catch c. execute the expression if the control enters into the catch block d. execute the expression which has no compilation errors 54. The Null Exception occurs a. When an application attempts to use null where an object is required b. When an application attempts to use null pointer only c. When an application does not have null pointer d. When an application attempts to use null program 55. In which packages of java, Exception classes are available a. Java.lang b. Java.io c. Java.exceptions 8|Page

d. Java.applet 56. Please read the program code and what will be the output. <script type="text/javascript"> <!-var myArray = new Array(); myArray[0] = "Baseball"; myArray[1] = "Cricket"; myArray[2] = "Football"; document.write(myArray[0] + myArray[2] + myArray[2]); //--> </script> e. BaseballCricketCricket f. BaseballFootballFootball g. BaseballCricketFootball h. BaseballFootballFootball 57. What is the output of the following code <script type="text/javascript"> 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("<br />The string is this long: " + myString.length); </script> a. The string is this long: 6 b. The string is this long: 10 c. The string is this long: 9 d. The string is this long: 91 58. What is the output of the following code <script type="text/javascript"> var myString = "123456"; document.write("The string is this long: " + myString.length); myString = myString + "0007890"; document.write("<br />The string is now this long: " + myString.length); </script> a. The string is this long: 6 The string is now this long: 7 b. The string is this long: 6 9|Page

The string is now this long: 10 c. The string is this long: 7 The string is now this long: 10 d. The string is this long: 8 The string is now this long: 10 59. What will be the output of the following code <script type="text/javascript"> 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("<br />The position of the second www = " + secondPos); </script> i. The position of www = 7 The position of the second www = 21 ii. The position of www = 3 The position of the second www = 24 iii. The position of www = 6 The position of the second www = 21 iv. The position of www = 8 The position of the second www = 22 60. In datagram-based communication such as UDP, the datagram packet contains the port number of its destination and UDP routes the packet to the appropriate application the ports are represented a. 8-bit numbers b. 16-bit numbers c. 32- bit numbers d. 64- bit numbers

Part C (Four Mark Question) 61. What are the steps to run java program a. Code compile run b. Code interpret compile run c. Code compile interpret run d. Code run interpret compile

10 | P a g e

62. Identified the correct statement a. System.out.print() in Java and scanf() in C are almost similar b. System.out.println() in Java and printf() in C are almost similar c. System.out.println() in Java and PRINT in BASIC d. 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. n j. t k. e l. C 64. What is the output of the following expression String S1=Computer, S2=Conputer S2.equels(S1); a. True b. False c. 0 d. 1 65. What is the value of S1 after execution of the following expression : String S1 = "Independence".replace('e', 'X'); a. S1=Independence b. S1=IndXpXndXncX c. S1=IndXpendence d. S1=XXXXXXXXXXXX 66. What is the output of the following code class 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) 11 | P a g e

} } } a. I am a good boy b. I am a good boy bad boy c. I am a bad boy d. I am a 67. What is the output of the given program code import 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 only c. It will add any two numbers irrespective of data types d. It will add any two double precession numbers 68. Find the correct output import 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'); 12 | P a g e

System.out.print("the output is " + obj); } } a. Arindam Ray b. Arindam Roy c. Arindom Ray d. Arindom Roy 69. What is the output of the following code import 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 " + +"times",20,20); } } m. init has been invoked 1 times n. init has been invoked 2 times o. init has been invoked 3 times p. init has been invoked 4 times

String.valueOf(initcounter)

70. User interface in Applet consist with three components, which are a. Components, Containers and LayoutManagers b. Frames , Containers and LayoutManagers 13 | P a g e

c. Frames, Constants and LayoutManagers d. Components, Frames and LayoutManagers 71. The Adaptor class in java is used to a. implement corresponding listener interfaces containing more than one method b. implement the general classes as interface c. implement the class as private class d. protect the all members

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

a. After Idle thread it goes to dead block b. 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 the Active Thread d. The method stop () always move the control to New Born State. 73. The application of thread is a. Task of memory b. Task of operating system c. Task of hard disk d. Task of software 14 | P a g e

74. The out put of the thread a. Is fixed for every time b. Is not fixed for every time c. Cannot be predicted d. Infinite result will come 75. Pick the correct statement if (args.length != 1) { System.out.println("Usage: java QuoteClient <hostname>"); return; } Args.length is the command line argument Args.lenght is the argument which will appear at the exception Args.length is the argument which will appear at the function loop Arg.length is the argument which will appear at the function name

a. b. c. d.

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

15 | P a g e

Você também pode gostar