Interview Questions and Answers - Order By Rating Q3421. What is struts.devMode?
Ans. The struts.devMode is used to make sure that framework is running in development mode or production mode by setting true or false. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  struts  struts.devMode Q3422. What is use of Revert in SVN? Tools
Ans. Revert your local changes.
There are 2 types of reverts -
1) Local Revert: It will delete all changes from files which you made after updates and before commit.
2) Repo Revert: Upload the changes to previous Repo. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  svn  subversion  version control system  configuration management Asked in 2 Companies Q3423. Can we have multiple threads consuming message stream from a single partition ?
Ans. Yes, by having multiple Consumer Groups. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  apache kafka  kafka  kafka consumer  kafka topic partitions  bigdata  consumer group Q3424. Can we have multiple threads consuming messages from a single partition if we have single Consumer Group ?
Ans. No, we can only have max 1 thread per partition in a single Consumer Group. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  apache kafka  kafka  kafka consumer  kafka topic partitions  bigdata  consumer group Q3425. If we have more threads than partitions in a kafka consumer, How can we model it efficiently ?
Ans. We will have to use multiple consumer groups in that case as threads will remain idle if we use single consumer group. A more sophisticated algorithm could be required with multiple groups if we have to ensure the order of consumption. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  apache kafka  kafka  kafka consumer  kafka topic partitions  bigdata  consumer group Q3426. Why Java is not considered pure OOP's language ? Core Java
Ans. There are 2 reasons for it.
1. Usage of Primitive types - Though Java provides classes for the primitive data types but as the usage of primitives is permissible, its considered unpure OOP's language.
2. Usage of Static members - Static members belong to the class and not objects and hence not considered fit for pure OOP's programming. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  oops  object oriented programming  object oriented language  primitive data types Asked in 2 Companies Q3427. Is Iterator a class ?
Ans. No, iterator is an interface that is used to parse through the elements of a Collection Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  collections  iterator Q3428. Can a lock be acquired on a class? How is it different than the object level lock ?
Ans. Yes, a lock can be acquired on the class. Class level lock is applicable on the whole class and hence on all objects of the class whereas the object level lock is applicable on the respective object. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  synchronization  class level lock  object level lock Q3429. Difference between Yielding and Sleeping ?
Ans. When a task invokes its yield method, it returns to the ready state. When a task invokes its sleep method, it returns to the waiting state. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  multithreading  threads  yielding  sleeping  thread states Q3430. What is the use of Runtime Class ?
Ans. This class is used to provide access to the Java runtime system Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  runtime class  jre  java runtimeFrequently asked. Q3431. What should a class do if its implementing an interface ? Core Java
Ans. It should either implement all interface methods or declare unimplemented methods as abstract. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  interfaces Asked in 1 Companies Basic   frequent Try 1 Question(s) Test Q3432. What should a class do if its extending an abstract class ? Core Java
Ans. It should either implement the abstract methods or re-declare them abstract. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  abstract class Asked in 2 Companies Basic   Frequent Q3433. What is a compilation unit in Java ?
Ans. Java Source Code File Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  compilation unit in java Q3434. What is Associativity while evaluating a Java statement ? Core Java
Ans. Associativity determines whether an expression is evaluated left-right or right-left. When an expression has two operators with the same precedence, the expression is evaluated according to its associativity. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  associativity  expression evaluation  operator Q3435. What is a package and what are its advantages ? Core Java
Ans. Package is a namespace that organizes a set of related classes.
Advantages of Packages
1. Better Organization of classes.
2. Saves from the problem of duplicate names as duplicate class names are allowed across different packages. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  package  advantages of packages Asked in 1 Companies Basic Q3436. When String literals are compared using ==, they always returns true if the string values are same because .. Reference Core Java
a. of overridden compareTo method b. of overridden compare method c. of String Pool d. == means that the object contents are equalAns.c. of String Pool
Q3437. Which of the following is true ? Core Java
a. Composition is Tightly Bound b. Inheritance is Tightly Bound c. Object can only hold reference of only one other object d. A Class cannot be extended by multiple classesAns.b. Inheritance is Tightly Bound
a. x==y on all literals always returns false b. x.equals(y) on all literals always returns false c. if x.equals(y) returns true, x==y returns true too d. if x.equals(y) returns false, x==y returns trueAns.c. if x.equals(y) returns true, x==y returns true too
a. Constructor without parameters declared by user b. Constructor provided by Java if no constructor is declared c. Constructor with empty body d. All of the aboveAns.b. Constructor provided by Java if no constructor is declared
Q3440. How can we create objects if we make the constructor private ? Core Java
a. We can't create objects if constructor is private b. We can only create objects if we follow singleton pattern c. We can only create one object d. We can create new object through static method or static blockAns.d. We can create new object through static method or static block
Q3441. What will be the output of following ?
String str1 = new String("String1");
String str2 = new String("String1");
System.out.print(str1 == str2);
System.out.print(str1.equals(str2));
str1 = str2;
System.out.print(str1 == str2); Core Java
a. falsetruetrue b. truetruetrue c. truetruefalse d. falsetruefalseAns.a. falsetruetrue
Q3442. What will be the output of following code ?
String str1 = "String1";
String str2 = "String1";
System.out.print(str1 == str2);
System.out.print(str1.equals(str2));
str1 = str2;
System.out.print(str1 == str2); Core Java
a. falsetruetrue b. falsefalsetrue c. truetruetrue d. falsefalsefalseAns.c. truetruetrue
Q3443. What will be the output of following code ?
String str1 = "String1";
String str2 = "String2";
str1.concat("String3");
System.out.print(str1);
System.out.print(str2);
Core Java
a. String1String2 b. String1String3String3 c. String1String3String1String3 d. String1String1Ans.a. String1String2
Q3444. What will be the output of following code ?
String str1 = "String1";
String str2 = "String2";
str1=str1.concat("String3");
System.out.print(str1);
System.out.print(str2); Core Java
a. String1String2 b. String1String3String2 c. String1String2String3 d. String1Stringg3String1Ans.b. String1String3String2
Q3445. Which method needs to be implemented if a class is implementing comparable interface ? Core Java
a. comp b. compare c. compareTo d. compareEqualsAns.c. compareTo
Q3446. Which of the following is false ? Core Java
a. A Class cannot override both hashcode and equals method. b. A class can override both hashcode and equals method. c. A Class must override hashCode method if its overridding equal method. d. A Class can override hashCode even if its not overridding equals method.Ans.a. A Class cannot override both hashcode and equals method.
a. interface b. abstract class c. final class d. util classAns.d. util class
Q3448. Which of the following can throw ClassCastException ? Core Java
a. UpCasting b. DownCasting c. Casting to incompatible data type d. Casting to StringsAns.b. DownCasting
a. final instance methods b. final static methods c. non final instance methods d. non final static methodsAns.c. non final instance methods
Q3450. x instanceOf y returns false .. Core Java
a. if x is an instance of y class b. if x is an instance of class implementing y interface c. if x is an instance of class extending y class d. if x is an instance of Class which is a parent of Y classAns.d. if x is an instance of Class which is a parent of Y class