Interview Questions and Answers - Order By Newest Q2651. What will the following print upon executing main method of Main class ?
public class BaseClass {
BaseClass(){
System.out.println("Hello I am in Base Class Constructor");
}
}
public class DerivedClass extends BaseClass{
DerivedClass(){
System.out.println("Hello I am in Derived Class Constructor");
}
}
public class Main {
public static void main(String[] args) {
DerivedClass derivedClass = new DerivedClass();
}
} Core Java
Ans. Hello I am in Base Class Constructor
Hello I am in Derived Class Constructor Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  constructor Q2652. What will the following code print upon executing main method of Main class ?
public class BaseClass {
BaseClass(){
System.out.println("Hello I am in Base Class Constructor");
}
}
public class DerivedClass extends BaseClass{
DerivedClass(){
System.out.println("Hello I am in Derived Class Constructor");
super();
}
}
public class Main {
public static void main(String[] args) {
DerivedClass derivedClass = new DerivedClass();
}
}
Core Java
Ans. There will be compilation error within constructor of Derived Class as "super must be the first statement in constructor body". Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  constructor Q2653. What will the following code print upon executing main method of Main class ?
public class BaseClass {
BaseClass(int x){
System.out.println("Hello I am in Base Class Constructor");
}
}
public class DerivedClass extends BaseClass{
DerivedClass(){
System.out.println("Hello I am in Derived Class Constructor");
}
}
public class Main {
public static void main(String[] args) {
DerivedClass derivedClass = new DerivedClass();
}
} Core Java
Ans. Compilation error as there is no default constructor available in BaseClass. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  constructor Q2654. What will the following code print upon executing main method of Main class ?
public class BaseClass {
BaseClass(int x){
System.out.println("Hello I am in Base Class Constructor");
}
}
public class DerivedClass extends BaseClass{
DerivedClass(){
super(1);
System.out.println("Hello I am in Derived Class Constructor");
}
}
public class Main {
public static void main(String[] args) {
DerivedClass derivedClass = new DerivedClass();
}
} Core Java
Ans. Hello I am in Base Class Constructor
Hello I am in Derived Class Constructor Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  constructor Q2655. Why line 4 in this code gives error saying "Cannot be referenced from a static context" ?
public class OuterClass {
public static void main(String[] args){
InnerClass innerClass = new InnerClass();
}
class InnerClass {
}
} Core Java
Ans. InnerClass is a non static inner class and hence can only be instantiated using instance of the outer class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  inner class Q2656. What will the following code print upon executing main method of Main class
public class BaseClass {
BaseClass(){
this(2);
System.out.println("Hello I am in Base Class Constructor");
}
BaseClass(int i){
System.out.println("Hello I am in Base Class int argument Constructor");
}
}
public class DerivedClass extends BaseClass{
DerivedClass(){
super(1);
System.out.println("Hello I am in Derived Class Constructor");
}
}
public class Main {
public static void main(String[] args) {
DerivedClass derivedClass = new DerivedClass();
}
} Core Java
Ans. Hello I am in Base Class int argument Constructor
Hello I am in Base Class Constructor
Hello I am in Derived Class Constructor Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  constructor Q2657. What will the following code print upon executing main method of Main class
public class BaseClass {
BaseClass(){
this(2);
System.out.println("Hello I am in Base Class Constructor");
}
BaseClass(int i){
System.out.println("Hello I am in Base Class int argument Constructor");
}
}
public class DerivedClass extends BaseClass{
DerivedClass(){
System.out.println("Hello I am in Derived Class Constructor");
}
}
public class Main {
public static void main(String[] args) {
DerivedClass derivedClass = new DerivedClass();
}
} Core Java
Ans. Hello I am in Base Class int argument Constructor
Hello I am in Base Class Constructor
Hello I am in Derived Class Constructor Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  constructor Q2658. In what terms C or C++ is a better language than Java ?
Ans. Fast. As a statically typed language, C is generally more performant than dynamically typed languages because the code is type-checked before it is executed. Java is gaining ground in terms of speed, but in the end, depending on how talented the C developer is, C can still be faster than Java. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2659. Why string pool concept has been introduced in string ? Core Java
Ans. Memory Sharing and Optimal memory utilization. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  String Pool Asked in 1 Companies Q2660. Write a Program to Find the maximum sum of the sub array ? Data Structure
This question was recently asked at 'Reddit'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Maximum subarray variant  arrays  sub array  subarray Asked in 1 Companies Q2661. Explain In place sorting algorithm ? Algorithm
This question was recently asked at 'Reddit,ServiceNow'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sorting algorithm   in place sorting algorithm Asked in 2 Companies Q2662. How can we check class file format in java ? Core Java
This question was recently asked at 'Jagan Institute of Management Studies (JIMS)'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2663. Difference between su <username> vs sudo su <username> Unix
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2664. What happens if we do su without user name ? Unix
Ans. it will start shell for user root and will ask for the password for root user Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2665. What are the benefits of Junits ? Junit
This question was recently asked at 'Cognizant ( CTS )'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Ans. Hadoop 1.x
It supports only MapReduce (MR) processing model.
It has limited scaling of nodes. Limited to 4000 nodes per cluster.
It has single Namenode to manage the entire namespace.
It has Single-Point-of-Failure (SPOF)
Works on concepts of slots – slots can run either a Map task or a Reduce task
MR has to do both processing and cluster resource management.
Hadoop 2.x
It supports MR as well as other distributed computing models like Spark, Hama, etc
It has better scalability. Scalable up to 10000 nodes per cluster.
Works on concepts of containers. Using containers can run generic tasks.
It has Multiple Namenode servers manage multiple namespace.
YARN does cluster resource management and processing is done using different processing models. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2668. What is the use of final String when Strings are immutable ? Core Java
This question was recently asked at 'Cyient'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  string Asked in 1 Companies This question was recently asked at 'naresh i technologies'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2670. Can you explain spring boot project Architecture? Spring Boot
Ans. The architecture of a Spring Boot project can be divided into three layers:
Presentation Layer:
This layer is responsible for handling user requests and generating responses. It includes the user interface, which can be a web UI or a RESTful API. Spring Boot provides various options to develop web applications, such as Spring MVC, Thymeleaf, and others.
Service Layer:
This layer contains the business logic of the application. It is responsible for processing the user requests and generating responses. The Service Layer interacts with the Data Access Layer to fetch and store data.
Data Access Layer:
This layer is responsible for interacting with the database or any other external data source. It includes the database model, repositories, and data access objects. Spring Boot provides support for various data access technologies, such as JPA, JDBC, and Spring Data JPA. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2671. Without configure ContextLoaderListenerAnd DispatcherServlet how to run spring MVCApplication? Spring
This question was recently asked at 'Naresh i Technologies'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2672. Is it possible to configure more than one config file in struts ? Struts
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2673. Which angular library needs to be included for Angular Routing / Views ? Angular Js
Ans. @angular/router Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2674. What are the things that need to be configured for creating route / views in angular ? Angular Js
Ans. Path
View Name
Component Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2675. Can we have multiple path maps to the same component ? Angular Js
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2676. Difference between Route and Redirect ? Angular Js
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Ans. Let creates a variable with a local scope whereas var creates it with a global scope. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2678. What are the different data types in typescript ? TypeScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2679. Difference between interface and type ? TypeScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2680. Difference between interface and class in typescript ? TypeScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve