Shivaji University Kolhapur M.Sc Semester-II Computer Science Paper March 2019
Which of the following best describes the inheritance in Java?
(a) A sub class can access all the methods in the base class
(b) A sub class can access all data in the base class
(c) A sub class can access both data and methods in the base class
(d) A sub class not necessarily can access all data and all methods in the base class
Which access type data gets derived as private member in derivied class?
(a) Private
(b) Public
(c) Protected
(d) Default
If there is a try block, then _____
(a) there should be a catch block
(b) there may not be any catch block
(c) there should be a finally block
(d) there may be multiple catch blocks
A Java file with extension’.class’ contains ______
(a) Java source code
(b) HTML tags
(c) Java Byte code
(d) A program file written in Java programming language
Which of the following is not an object oriented programming paradigm?
(a) Encapsulation
(b) Inheritance
(c) Polymorphism
(d) Dynamic memory allocation
public class Test {
public static void main (String[] args){
int[] x ={1,2,3,4);
char[] y= {‘a’,’b’,’c’,’d’};
for (inti=0; i<x.length; i +=2)
for (int j=y.length-1;j>0;j–)
if (((i+j)%2)==0)
System.out.print(x[i]);
else
System.out.print(y[j]);
}
}
Which of the following does this program print?
Note – The value of k % 2 is 0 only when k is even.
(a) d1bd3b
(b) d1b1d3b3
(c) d12cd34c
(d) d1b2c2d3b4c4
Which of the following is true regarding the execution of Java applets?
(a) HTML file is must to run an applet
(b) Any file containing the <APPLET> tag can be used during an executioin
(c) Compliation of source is not needed for applet execution
(d) The source file should be in the local machine
Which of the following is a valid specifier with the main() method?
(a) public
(b) private
(c) protected
(d) default (i.e., nothing)
Which of the following is called when a method having the same name as that the name of the class where it is defined?
(a) abstract
(b) this
(c) final
(d) constructor
Which of the following is true about the break statement in Java?
(a) Break stops the execution of entire program
(b) Break halts the execution and forces the control out of the loop
(c) Break forces the control oout of the loop and starts execution of next iteration
(d) Break halts the execution of the loop for certain time frame
Which of the following is usually used with the switch statement?
(a) continue
(b) exit
(c) break
(d) do
Which of the following statements is/are incorrect?
(a) public members of a class can be accessed by any code in the program
(b) private members of class can only be accessed any members in the same class
(c) private members of a class can be inherited by a subclass, and become protected members in subclass
(d) protected members of a class can be inherited by a subclass, and become private members of the subclass
For which purpose packages are used in Java?
(a) Categorizes data
(b) Organizing java classes into namespaces
(c) For faster compilation
(d) None
Which of the following is an incorrect statement about packages?
(a) Interfaces specifies what class must do but not how it does
(b) Interfaces are specified public if they are to be accessed by any code in the program
(c) All variables in interface are implicitly final and static
(d) All variables are static and methods are public if interface is defined public
Leave a Reply