You are on page 1of 18

BC0047 BCA-IV(NEW) JAVA PROGRAMMING

1. Java is purely object oriented and provides d. e. f. g. Ans. D 2. Compilation is the process of converting the code into language that is h. i. j. k. Ans. B 3. _______ is the ability of an application to perform multiple tasks at the same time. l. m. n. o. Ans. C 4. BY code is a highly optimized set of ________ designed to be executed by the java runtime system, which is called JVM. p. q. r. s. Ans. C 5. There are _______ kind of data types in java. t. 8 Date Information Instructions Machine Dynamic language Interpreted Multithreading None of the above Assembly language Machine language High level language Low level language Abstraction, inheritance Encapsulation, polymorphism Abstraction, polymorphism All of the above

u. 4 v. 2 w. 3 Ans. C 6. Rules for naming variable in Java. x. y. z. aa. Ans. D 7. The new operator is used to create a bb. Function object cc. Class object dd. Method object ee. None of the above Ans. B 8. To display data on screen used ff. println( ) gg. print( ) hh. none of the above ii. a & b Ans. D 9. Operator which concatenates two strings is jj. * kk. ll. + mm.None of the above Ans. C 10. In Java, a class that is inherited is called nn. Subclass oo. Superclass Must not a keyword in java Must not begin with a digit Must not contain embedded spaces All of the above

pp. a and b qq. None of the above Ans. B 11. How many relationship in Java rr. 4 ss. 2 tt. 3 uu. 6 Ans. A 12. Which keyword is used to derive a class from a superclass? vv. Implements ww.Extends xx. Package yy. None of the above Ans. B 13. How many access specifier in Java. zz. 3 aaa.2 bbb.4 ccc.None of the above Ans. A 14. Protected access specifier are accesses ddd.Accessibles to the subclasses of the class in which they are declared eee.Accessibles to all class (implicitly & explicitly) fff. Both a & b ggg.None of the above Ans. A 15. Super keyword is used for hhh.Calling superclass constructor iii. To access hidden member of superclass jjj. Both s & b

kkk.None of the above Ans. C 16. An abstract class is used as lll. A subclass to derive specific class of same kind mmm.A base class to derive specific class of the same kind nnn.A base class to implement specific class of the same kind ooo.None of the above Ans. B 17. Java provides a mechanism for partitioning the class namespace into more manageable chunks. This mechanism is ppp.Interface qqq.Inheritance rrr. Package sss. All of the above Ans. C 18. By defaults all the method in interface is ttt. Public uuu.Abstract vvv.a & b www.All of the above Ans. B 19. Which keyword is used for implementing an interface xxx.Extends yyy.Package zzz.Implements aaaa.None of the above Ans. C 20. Which mechanism is used in Java when an abnormal event occur during program execution and stop flow of instruction. bbbb.Exception handling cccc.Exception

dddd.Inheritance eeee.None of the above Ans. A 21. Which exception is thrown when an exceptional arithmetic condition has occurred? ffff.Null pointer exception gggg.Arithmetic exception hhhh.Array index out of bound exception iiii. None of the above Ans. B 22. What are the different exception handling technique? jjjj. Try kkkk.Finally llll. Catch mmmm.All of the above Ans. D 23. The two major classes for byte streams are nnnn.Input and output oooo.Input stream and output stream pppp.Reader and writer classes qqqq.None of the above Ans. B 24. What are different methods of input stream. rrrr.int read ( ) ssss.int read (byte [] b) tttt. int available uuuu.All of the above Ans. D 25. What are different methods of output stream? vvvv.void close ( ) wwww.void write (int n) xxxx.int read (byte [] b, int off, int len)

yyyy.Both a and b Ans. D 26. The read line( ) method of the buffered class is used for zzzz.Writing line of text to the console aaaaa.Reading line of text from the console bbbbb.Both a and b ccccc.None of the above Ans. B 27. The random access files class has several methods that allow random access to contact with in the file, these method are ddddd.void seek (long pos) eeeee.long getFilePointer ( ) fffff.long length ggggg.All of the above Ans. D 28. Serialization is the key to implementing hhhhh.Input output stream iiiii.Persistence program jjjjj.Program kkkkk.All of the above Ans. B 29. Read object () method of object input stream class is used to lllll.Write object to the stream mmmmm.Read object and write object to stream nnnnn.Read object and write object to stream ooooo.None of the above Ans. C 30. Input and output stream are super classes used for reading from and writing to ppppp.Character streams qqqqq.Byte streams rrrrr.Both a and b

sssss.None of the above Ans. B 31. The applet tag is used to embed an applet in an HTML document the applet tag takes ttttt.Zero parameter uuuuu.More than one parameter vvvvv.Zero or more parameters wwwww.None of the above Ans. C 32. Life cycle of an applet has _________ methods. xxxxx.3 yyyyy.5 zzzzz.2 aaaaaa.4 Ans. D 33. An event comprise of components bbbbbb.Event object cccccc.Event source dddddd.Event handler eeeeee.All of above Ans. D 34. Types of component events are ffffff.Component-hidden gggggg.Component-moved hhhhhh.Component-resized iiiiii.Component-shown jjjjjj.All of the above Ans. E 35. The ODBC is written in ________ language, a java program cannot directory communicate with an ODBC driver. kkkkkk.Java language llllll.C language

mmmmmm.Both a & b nnnnnn.None of the above Ans. B 36. Java soft created the JDBC-ODBC bridge driver that translates the oooooo.ODBC API to JDBC API pppppp.JDBC API to ODBC API qqqqqq.JDBC API to other API rrrrrr.None of the above Ans. B 37. RMI stands for ssssss.Remote method invocation tttttt.Real mechanism interface uuuuuu.Remote mechanism interface vvvvvv.None of the above Ans. A 38. JVM stands for wwwwww.Java virtual mechanism xxxxxx.Java virtual machine yyyyyy.Java value machine zzzzzz.None of the above Ans. B 39. Local objects are objects that execute on the aaaaaaa.Other machine bbbbbbb.Local machine ccccccc.a & b both ddddddd.None of the above Ans. B 40. Remote objects are object that execute on the eeeeeee.Local machine fffffff.Other machine ggggggg.Both a & b

hhhhhhh.None of the above Ans. B 41. CORBA stands for iiiiiii.Common object request broken architecture jjjjjjj.Common object response broken architecture kkkkkkk.Common object remote broken architecture lllllll.None of the above Ans. A 42. Java Beans is the mmmmmmm.Software component architecture nnnnnnn.System component architecture ooooooo.Software common architecture ppppppp.Simple component architecture Ans. A 43. The bean box allows to qqqqqqq.Resize and move beans around rrrrrrr.Save and restores sets of bean sssssss.Add new beans from JAR files ttttttt.All of the above Ans. D 44. Bean obtains all the benefits of Javas. uuuuuuu.Write once, run anywhere vvvvvvv.Read once, run anywhere wwwwwww.Both a and b xxxxxxx.None of the above Ans. A 45. JSP stands for yyyyyyy.Java standard pages zzzzzzz.Java servlet pages aaaaaaaa.Java server pages bbbbbbbb.None of the above

Ans. C 46. To test JSP user need a cccccccc.JSP editor dddddddd.JSP engine eeeeeeee.Java web server ffffffff.None of the above Ans. B 47. JSP look like HTML True or False gggggggg.False hhhhhhhh.True Ans. B 48. ______ are they component of server side java development. iiiiiiii.JSP jjjjjjjj.Java servlet kkkkkkkk.Both a & b llllllll.None of the above Ans. B 49. JDK stands for mmmmmmmm.Java developer kit nnnnnnnn.Java decode kit oooooooo.Java development kit pppppppp.None of the above Ans. C 50. In java, what the use of extends keyword qqqqqqqq.Access the variables & methods of base class rrrrrrrr.Access the variables & methods of subclass ssssssss.Both a and b tttttttt.None of the above Ans. A

51. How many types of servlet in java. uuuuuuuu.1 vvvvvvvv.2 wwwwwwww.3 xxxxxxxx.4 Ans. B 52. _______ is the result of compiling a java program is interpreted and executed. yyyyyyyy.Java code zzzzzzzz.File name aaaaaaaaa.Byte code bbbbbbbbb.All of the above Ans. C 53. Which tool is used when you want to document the java source file with proper comment entries. ccccccccc.Javap ddddddddd.Javah eeeeeeeee.Jdb fffffffff.Javadoc Ans. D 54. Java is the interpreter that is used to execute compiled java application. ggggggggg.True hhhhhhhhh.False Ans. A 55. The javac program is the tool used to convert java files into class files that cannot be run by interpreter. iiiiiiiii.False jjjjjjjjj.True Ans. A 56. If you need to extract more than one character at a time, you can use one. kkkkkkkkk.CharAt ( )

lllllllll.getchars ( ) mmmmmmmmm.getch ( ) nnnnnnnnn.None of the above Ans. B 57. Which method return a copy of the invoking string from which any leading and trailing white space has been removed. ooooooooo.Replace( ) ppppppppp.Contact( ) qqqqqqqqq.Trim( ) rrrrrrrrr.None of the above Ans. C 58. Null pointer exception is thrown when an application attempts to use null where an object is required. sssssssss.True ttttttttt.False Ans. A 59. The code in the finally block is not executed regardless of whether an exception is thrown or not. uuuuuuuuu.False vvvvvvvvv.True Ans. A 60. The capability of an object to exist beyond the execution of the program that created it is know as wwwwwwwww.Serialization xxxxxxxxx.Persistence yyyyyyyyy.Inheritance zzzzzzzzz.a and b Ans. B 61. Public class switchcase { public static void main (String ar[] ) int weekday = 3;

switch (weekday) { case 1: System.out.println (Sunday); break; case 2: System.out.println (Monday); break; case 3: System.out.println (Tuesday); break; case 4: System.out.println (Wednesday); break; case 5: System.out.println (Thursday); break; case 6: System.out.println (Friday); break; case 7: System.out.println (Saturday); break; default:System.out.println (Not a valid day); break; } } } aaaaaaaaaa.Thursday bbbbbbbbbb.Saturday cccccccccc.Monday dddddddddd.Tuesday Ans. D 62. Class test { Public static void main(String ar[] ) { int i; for (i = 1; i<=10; j++) { system.out.print(i); } } eeeeeeeeee.Public, i, ; ffffffffff.Main, string, j, system gggggggggg.Both are a & b hhhhhhhhhh.None of the above Ans. B 63. Public class test { Public static void main (string arg [] ) { int n = 4; int fact = i; int i = 1 while (i<=n) { fact = fact * i

i++; } System.out.println (factorial of + n +is + fact); } } iiiiiiiiii.120 jjjjjjjjjj.720 kkkkkkkkkk.24 llllllllll.None of the above Ans. C 64. Class Demo { public static void main (string args []) { String S1 = Hi; String S2 = hi; Systems.out.print ln (S1 + equalignorecase + S2 + + S1.equalignorecase (S2)); System.out.println (S1.equals (S2)); } } mmmmmmmmmm.True, false nnnnnnnnnn.False, true oooooooooo.True, true pppppppppp.False, false Ans. A 65. Match the following a. Upper b. Concat c. Exception handles d. Inheritance e. Interface qqqqqqqqqq.d, e, a, b, c rrrrrrrrrr.e, d, b, a, c ssssssssss.c, d, e, a, b tttttttttt.None of the above Ans. C a. Extends b. Implements c. To uppercase( ) d. + e. Try, catch

66. Define the steps of applet life cycle. uuuuuuuuuu.stop( ), start( ), init( ), destroy( ). vvvvvvvvvv.init( ), stop( ), start( ), destroy( ). wwwwwwwwww.start( ), init( ), destroy( ), stop( ). xxxxxxxxxx.init( ), start( ), stop( ), destroy( ). Ans. D 67. Steps in servlet life cycle yyyyyyyyyy.Create, load, servlet request, select servlet instance, select.service method, wait for next request, destroy ( ), unload zzzzzzzzzz.Select servlet instance, load the servlet, create, select request, wait, unload.service ( ) method aaaaaaaaaaa.Server load, servlet create, init ( ), servlet request, select servlet instance, select service method, wait, unload bbbbbbbbbbb.None of the above Ans. C 68. Keyword used in exception handling are ccccccccccc.try, final, catch ddddddddddd.try, static, finally eeeeeeeeeee.try, catch, finally fffffffffff.final, caught, try Ans. C 69. Variable can be declare inside of interface declarations. They are implicitly final and static, meaning they cannot be changed by the implementing class. ggggggggggg.True hhhhhhhhhhh.False Ans. A 70. Find output of following program class demo1 { public static void main (String a []) { String s = Now is the time for all good men + to come to the aid of their country.; System.out.println (indexOf(t)= + s.indexOf(t)); System.out.println (lastIndexOf (t) = + s.lastIndexOf(t));

} } iiiiiiiiiii.8,62 jjjjjjjjjjj.9,60 kkkkkkkkkkk.7,65 lllllllllll.11,55 Ans. C 71. find o/p class getchars { public static void main (String ar[]) { String s = this is a demo of the get chars method; int start = 10; int end = 14; char buf [] = new char [end - start]; s.getchars (start, end, buf, 0); System.out.println (buf); } } mmmmmmmmmmm.of nnnnnnnnnnn.the ooooooooooo.demo ppppppppppp.b & c Ans. C 72. find error class demo3 { public static void main (String a[]) { char chars [] = { a, b, c }; String s = new String (char); System.out.println (s.length); } } qqqqqqqqqqq.char rrrrrrrrrrr.system.out sssssssssss. , ttttttttttt. , string. length ( )

Ans. D 73. find o/p class abc { public static void main (String as[]) { Char ch[ ] = {a, b, c, d, e, f} String s = new string (ch, 2, 3); System.out.println (s); } } uuuuuuuuuuu.b, c, d vvvvvvvvvvv.c, d, e wwwwwwwwwww.d, e, f xxxxxxxxxxx.a, b, c Ans. B 74. What is the o/p of following code:public class TX { public static void main (String ar[ ] ) { int a = 5, b=5, c, d; c = a++; System.outprintln (a = +a+c=+c); d = ++b; System.out.println(b = +b+d = +d); } } a. 7, 6 5, 5 b. 5, 6 6, 6 c. 6, 5 6, 6 d. 4, 4 5, 4 Ans. C 75. Match the following

a. a kind of b. Boolean c. JDB ODBC bridge d. Print writer e. Remote object (a). a, c, b, d, e (b). c, d, a, e, b (c). e, c, b, d, e (d). b, c, a, d, e Ans. B

a. Driver b. RMI c. Relationship d. Data type e. Get writer

You might also like