Hi Friends,
In this post, I'm sharing Java/REST/SQL interview questions in SAP.
You can also read my other real interview in the below posts:
Question 1:
Draw REST Architecture
Answer:
Question 2:
Name core components of HTTP request.
Answer:
Each HTTP request includes five key elements:
Question 3:
Explain the term statelessness with respect to RESTFUL Web service.
Answer:
In REST, ST itself defines State Transfer and statelessness means complete isolation. This means, the state of the client's application is never stored on the server.
In this process, the client sends all the information that is required for the server to fulfill the HTTP request that has been sent. Thus every client request and the response is independent of the other with complete assurance of providing required information.
Question 4:
State the core components of an HTTP response.
Answer:
Every HTTP response includes 4 key elements:
Question 5:
What is cloud and what are the benefits of Cloud Computing?
Answer:
A cloud is actually a collection of web servers [instead of single server] owned by 3rd party. Cloud provides inexpensive, efficient and flexible alternative to computers.
Benefits of Cloud are:
Question 6:
class A{
}
class B extends A{
}
class C extends B{
}
public class MainClass{
static void overloadedMethod(A a){
System.out.println("One");
}
static void overloadedMethod(B b){
System.out.println("Two");
}
static void overloadedMethod(Object obj){
System.out.println("Three");
}
public static void main(String[] args){
C c = new C();
overloadedMethod(c);
}
}
Given above code, what will be the output?
Answer:
Output: Two
Explanation:
In method overloading, more specific method is chosen over generic.
Question 7:
As a best practice , what should be the maximum nesting level for associations in URI (e.g. /vacations/{id}/reviews)?
Answer:
3
Question 8:
In a class, one method has two overloaded forms.One form is defined as static and another form is defined as non-static. Is that method properly overloaded?
Answer:
Yes. That method is properly overloaded. Compiler checks only method signature to verify whether a particular method is properly overloaded or not. It doesn't check static or non-static feature of the method.
Question 9:
Method signature consists of which one out of below:
Answer:
3
That's all for this interview post.
Hope this post helps everybody in their java interviews.
Thanks for reading !!
In this post, I'm sharing Java/REST/SQL interview questions in SAP.
You can also read my other real interview in the below posts:
- Java Interview @ OrangeMantra
- Java Interview @ Concirrus
- Java Interview @ NexGen Solutions
- Java Interview @ Capgemini
- Java Interview @ Dew Solutions
- Java Interview @ Birdeye
- Java Interview @ RBS
- Java Interview @ Rocketalk
- Java Interview @ Aricent
- Java Interview @ WDTS
- Java Interview @ Handygo
Question 1:
Draw REST Architecture
Answer:
Question 2:
Name core components of HTTP request.
Answer:
Each HTTP request includes five key elements:
- The verb which indicates HTTP methods such as GET, POST, PUT, DELETE.
- URI: Stands for Uniform Resource Identifier. It is the identifier for the resource on server.
- HTTP version which indicates HTTP version , for example -- HTTP v1.1
- Request Header carries metadata (as key-value pairs) from the HTTP request message. Metadata could be a client type, the format that client supports, message body format and cache settings.
- Request Body: It indicates the message content or resource representation.
Question 3:
Explain the term statelessness with respect to RESTFUL Web service.
Answer:
In REST, ST itself defines State Transfer and statelessness means complete isolation. This means, the state of the client's application is never stored on the server.
In this process, the client sends all the information that is required for the server to fulfill the HTTP request that has been sent. Thus every client request and the response is independent of the other with complete assurance of providing required information.
Question 4:
State the core components of an HTTP response.
Answer:
Every HTTP response includes 4 key elements:
- Status/Response code: Indicates server status for the resource present in HTTP request e.g. 404 means, resource not found and 200 means , response is OK.
- HTTP Version
- Response Header: Contains metadata for the HTTP response in the form of key-value pairs. e.g. content length, content type, response date and server type
- Response Body: Indicates response message content or resource representation.
Question 5:
What is cloud and what are the benefits of Cloud Computing?
Answer:
A cloud is actually a collection of web servers [instead of single server] owned by 3rd party. Cloud provides inexpensive, efficient and flexible alternative to computers.
Benefits of Cloud are:
- No need of extra space required to keep all the hardware [Servers, Digital storage]
- Companies don't need to buy software or software license for all it's employees. They just pay a small fees to the cloud computing company to let their employees access a suite of software online.
- It also reduces IT problems and costs.
Question 6:
class A{
}
class B extends A{
}
class C extends B{
}
public class MainClass{
static void overloadedMethod(A a){
System.out.println("One");
}
static void overloadedMethod(B b){
System.out.println("Two");
}
static void overloadedMethod(Object obj){
System.out.println("Three");
}
public static void main(String[] args){
C c = new C();
overloadedMethod(c);
}
}
Given above code, what will be the output?
Answer:
Output: Two
Explanation:
In method overloading, more specific method is chosen over generic.
Question 7:
As a best practice , what should be the maximum nesting level for associations in URI (e.g. /vacations/{id}/reviews)?
Answer:
3
Question 8:
In a class, one method has two overloaded forms.One form is defined as static and another form is defined as non-static. Is that method properly overloaded?
Answer:
Yes. That method is properly overloaded. Compiler checks only method signature to verify whether a particular method is properly overloaded or not. It doesn't check static or non-static feature of the method.
Question 9:
Method signature consists of which one out of below:
- Method name, return type and number of arguments
- Access modifier, method name and types of arguments
- Method name, number of arguments, types of arguments and order of arguments
- Return type, access modifier and order of arguments
Answer:
3
That's all for this interview post.
Hope this post helps everybody in their java interviews.
Thanks for reading !!
No comments:
Post a Comment