In Java, when we implement an interface method, it must be declared as: (A) Private (B) Protected (C) Public (D) Friend

1 Answer

Answer :

(C) Public

Related questions

Description : If a function is friend of a class, which one of the following is wrong ? (A) A function can only be declared a friend by a class itself. (B) Friend functions are not members of a class, they are ... are members of a class. (D) It can have access to all members of the class, even private ones.

Last Answer : (C) Friend functions are members of a class.

Description : When the inheritance is private, the private methods in base class are.................. in the derived class (in C++). (A) inaccessible (B) accessible (C) protected (D) public

Last Answer : (A) inaccessible

Description : Data input is A) an abstract class defined in java.io B) a class we can use to read primitive data types C) an interface that defines methods to open files. D) an interface that defines methods to read primitive data types.

Last Answer : D) an interface that defines methods to read primitive data types.

Description : Data input is A) an abstract class defined in java.io B) a class we can use to read primitive data types C) an interface that defines methods to open files. D) an interface that defines methods to read primitive data types.

Last Answer : D) an interface that defines methods to read primitive data types.

Description : Which interface does java.util.Hashtable implement?

Last Answer : Ans. Java.util.Map

Description : State true or false for Java Program. i) All class variables are instance variables ii) All protected methods are friendly methods A) i-false, ii-false B) i-false, ii-true

Last Answer : B) i-false, ii-true

Description : State true or false for Java Program. i) Data members of an interface are by default final ii) An abstract class has implementations of all methods defined inside it. A) i-false, ii-false B) i-false, ii-true C) i-true, ii-false D) i-true, ii-true

Last Answer : C) i-true, ii-false

Description : State true of false. i) Public can only be assigned to class ii) Protected protects a statement iii) Protected method is never accessible outside the package iv) Friendly variable may be accessible outside class A) i- ... -false, ii-true, iii-false, iv-false D) i-true, ii-false, iii-false, iv-true

Last Answer : C) i-false, ii-true, iii-false, iv-false

Description : Which of the following statements is correct? (A) Every class containing abstract method must not be declared abstract. (B) Abstract class cannot be directly initiated with ‘new’ operator. (C) Abstract class cannot be initiated. (D) Abstract class contains definition of implementation.

Last Answer : Answer: B,C

Description : A method name myMethod( ) that needs two integer arguments is declared as A) public void myMethod( ); B) public void myMethod(int a, int b); C) public void myMethod(int a, b); D) public int myMethod(a, b);

Last Answer : B) public void myMethod(int a, int

Description : Each method in a java class must have a unique name . A) Not necessary B) True C) False D) None of the above

Last Answer : A) Not necessary

Description : Which of the following characteristics of constructor are true. i) They should be declared in the public section. ii) They are invoked automatically when the objects are created. iii) They do not have return type and void also. ... and v C) Only i, iii, iv and v D) All i, ii, iii, iv and v

Last Answer : D) All i, ii, iii, iv and v

Description : ...................... of a remotely accessible object must implement ................ A) all methods, RemoteException B) class, RemoteException C) class, RemoteInterface D) all methods, RemoteInterface

Last Answer : C) class, RemoteInterface

Description : Which of the following is/ are the characteristics of friend function. A) It is not in the scope of the class to which it has been declared as friend. B) It can invoke like a normal function without the help of any object. C) Usually, it has the objects as arguments. D) All of the above.

Last Answer : D) All of the above.

Description : If a variable is declared final, it must include ...................... value. A) integer B) no C) initial D) float

Last Answer : C) initial

Description : In ............. method, the word is written to the block in both the cache and main memory, in parallel. (A) Write through (B) Write back (C) Write protected (D) Direct mapping

Last Answer : (A) Write through 

Description : System.in.read() is being used, the program must specify the .................. clause. A) throws.java.out.IOException B) throws.java.in.IOException C) throws.java.io.IOException D) throws.java.io.InException

Last Answer : C) throws.java.io.IOException

Description : When a program class implements an interface, it must provide behavior for A) two methods defined in that interface B) any methods in a class C) only certain methods in that interface D) all methods defined in that interface

Last Answer : D) all methods defined in that interface

Description : Consider the following JAVA program: public class First { public static int CBSE (int x) { if (x < 100) x = CBSE (x +10); return (x - 1); } public static void main (String[] args){ System.out.print(First.CBSE(60)); } } What does this program print? (1) 59 (2) 95 (3) 69 (4) 99

Last Answer : (2) 95 

Description : In Java servlet method init( ) is called ..................... times. A) 1 B) 2 C) 0 D) multiple

Last Answer : A) 1

Description : The Servlet Response interface enables a servlet to formulate a response for a client using the method ............... (A) void log(Exception e, String s) (B) void destroy() (C) int getServerPort() (D) void setContextType(String Type)

Last Answer : (D) void setContextType(String Type)

Description : Which of the following is not a type of cloud? a) Private b) Public c) Protected d) Hybrid

Last Answer : Protected

Description : Difference between Public, Private, Default and Protected ?

Last Answer : Ans. Private - Not accessible outside object scope. Public - Accessible from anywhere. Default - Accessible from anywhere within same package. Protected - Accessible from object and the sub class objects.

Description : Describe PRIVATE, PROTECTED and PUBLIC – the differences and give examples.

Last Answer : class Point2D{ int x; int y; public int color; protected bool pinned; public Point2D() : x(0) , y(0) {} //default (no argument) constructor }; Point2D MyPoint; You cannot directly ... .pinned = true; // Compiler will issue a compile ERROR bool isPinned = MyPoint.pinned; // no problem

Description : What is public, protected, private?

Last Answer : Public, protected and private are three access specifier in C++. Public data members and member functions are accessible outside the class. Protected data members and member functions are only available to derived classes. Private data members and ... *b) { int t; t = *a; *a = *b; *b = t; }

Description : A ………………. is an extension of an enterprise’s private intranet across a public Network such as the Internet across a public Network such as the Internet, creating a secure private connection. A) VNP B) VPN C) VSN D) VSPN

Last Answer : B) VPN

Description : Working set model is used in memory management to implement the concept of (A) Swapping (B) Principal of Locality (C) Segmentation (D) Thrashing

Last Answer : (B) Principal of Locality

Description : Module design is used to maximize cohesion and minimize coupling. Which of the following is the key to implement this rule? (A) Inheritance (B) Polymorphism (C) Encapsulation (D) Abstraction

Last Answer : (C) Encapsulation

Description : Which of the following statements is/are true w.r.t. Enterprise Resource Planning (ERP)? (A) ERP automates and integrates majority of business processes. (B) ERP provides access to information in a Real Time Environment. (C) ERP is ... (A) and (B) true; (C) false (4) (A) true; (B) and (C) are false

Last Answer : Answer: 3

Description : In which of the following categories of protected area in India are local people not allowed to collect and use the biomass? a. Biosphere Reserves b. Wetland declared under Ramsar Convention c. Wildlife Sanctuaries d. National Parks e. None of the above

Last Answer : d. National Parks

Description : A reserve of land usually declared and owned by national government which is protected from most human development works and pollution is known as _________. a) National park b)hotspot c )biosphere reserve d)refuge

Last Answer : a) National park

Description : Which of the following keywords are used to control access to a class member? A) default B) break C) protected D) goto

Last Answer : C) protected

Description : State True or False. i) A satic function can have access to only other static members (functions or variables) declared in the same class. ii) A static member function can be called using the class name (instead of its objects) A) True, True B) True, False C) False, True D) False, False

Last Answer : B) True, False

Description : A three dimensional array in C' is declared as int A[x][y][z]. Here, the address of an item at the location A[p][q][r] can be computed as follows (where w is the word length of an integer): (A) &A[0][0][0]+w(y*z*q+z*p+r) (B) &A ... *q+r) (C) &A[0][0][0]+w(x*y*p+z*q+r) (D) &A[0][0][0]+w(x*y*q+z*p+r)

Last Answer : Answer: B

Description : What is the default java package?

Last Answer : A: java.lang

Description : Name the primitive data-types in java.

Last Answer : A: byte, short, int, long, float, double, char and boolean

Description : Mention other ways in which java handles exceptions.

Last Answer : A: Java can handle exception using the try-catch block, throws keyword and throw keyword.

Description : Why did you write java.util package? (only if you use classes like Scanner or StringTokenizer)

Last Answer : A: To include the functions of the Scanner or StringTokenizer class from the java.util package.

Description : What is significance of import java.io.* in your program?

Last Answer : A: The line imports all the classes of the java.io package into the current program.

Description : What is Inheritance? How is it implemented in Java?

Last Answer : A: The ability of a class to adopt/share the properties (data and functions) completely or partially from another class is called Inheritance. In Java, it is implemented by the use of the keyword, extends.

Description : What is Polymorphism? How is it implemented in Java?

Last Answer : A: It literally means the ability to take ‘more than one forms’. The ability of a method to behave in more than one form is called polymorphism. In Java, it is implemented by method (function) overloading (compile time polymorphism) and method overriding (runtime polymorphism).

Description : What is Data Abstraction? How is it implemented in Java?

Last Answer : A: Act of representing only essential features without including its background details is called Abstraction. Data Abstraction can also be defined as the process of hiding the implementation details and showing ... Java, it is implemented by the use of interfaces or by making the class abstract.

Description : What is Encapsulation? How is it implemented in Java?

Last Answer : A: Binding up of data and associated functions together into a single unit called (class) is called Encapsulation. In Java, it is implemented by the use of a class.

Description : Is Java an Object Oriented language?

Last Answer : A: Yes.

Description : State true or false. i) comparisons precede logical operations in java ii) assignment operations succeed increment operations iii) arithmetic operations succeed comparisons iv) x precede + A) i-true, ii-true, iii-false, ... false, ii-true, iii-false, iv-false D) i-true, ii-false, iii-false, iv-true

Last Answer : A) i-true, ii-true, iii-false, iv-true

Description : In java, string is a ............. A) primitive data type B) abstract data type C) combination of boolean D) None of the above

Last Answer : B) abstract data type