Hackerrank VERIFIEDD
Hackerrank VERIFIEDD
double a = 5.5;
double b = 3.0;
double c = Math.pow(a,b);
System.out.println(c);
double d = Math.sqrt(a);
System.out.println(c);
System.out.println(e);
System.out.println(f);
Options
A)166.375
2.345207879911715
5.5
B) 166.375
2.345207879911715
2.5
5.5
C) 166.375
2.345207879911715
3) In HTML5, you are working on Web Forms 20 Which of the following statements about attributes
in the output tag are correct
Statements:
1. The for attribute is used to determine the relationship between the result of the operation and the
elements that is used in the operation
2. The form attribute is used to determine the form to which the output tag is redirected
3. The name attribute is used to determine the name of the output element
A)1 and 2
B)2 and 3
C)1 and 3
D) All of these
4)What is the output of the following code?
class HackerEarth {
int getValue() {
try {
String[] Languages = {
"Try Block",
};
System.out.println(Languages[1]);
} catch (Exception e) {
return returnValue;
} finally {
returnValue += 10;
return returnValue;
HackerEarth
}
Options:
Finally Block:20
Main Block: 20
2)Catch Block:10
Main Block:10
3)Catch Block: 10
Main Block: 20
4)Compilation error
Using the Spring AOP framework, what are the join point methods of the following pointcut
expressions? execution(public**(..))
4) The execution of all public method in class belonging to the default java package
6) Which AOP framework does Spring AOP integrate with for advanced AOP features?
1) JAspect
2) AspectC
3) AspectJ
4) WeaveJ
7) Which Spring cloud module is used to externalize the configuration of microservices into a
centralized place?
8) In Spring Security, what is the main difference between authentication and authorization?
9) John is working on a spring. While working on a application he wants to know the case that
would except the @Transactional annotation applied on an interface to work as excepted. Help him
to find the which of the following can be used in the above-mentioned context
B) Only 2
C) Both 1 and 2
D) None of these
10) Which of the following statements about the default methods in Java are true
Statement
Options
1)1, 2, and 3
2)1,2 and 4
3)1 and 2
4)2 and 3
1)(resource)/(resource-id)/(sub-resource)/(sub-resource-id)
2)[resource)(sub-resource)/(sub-resource-id)
3)(sub-resource)/(sub-resource-id)/[resource]/[resource-id)
4)[resource)/(resource-id)/(sub-resource-id)/(sub-resource)
13) How can you define the order of bean initialization when multiple beans depend on each other?
14) A bean can have more than or name in spring boot using multiple attributes
1) TRUE
2) FALSE
Code:
class Hackjava {
int i=1,s=0;
s=s+i;
i++;}
System.out.println(s);}}
1)15
2)21
3)1
4) Syntax Error
16) In REST API web services, which of these methods is used to remove configuration on a device
HTTP /devices/(id/configurations/[id]
1) POST
2) DELETE
3) OPTIONS
4) PUT
17) Which of the following REST methods are almost identical to each other?
1) TRUE
2) FALSE
19) What is the default mode of of auto wiring?
1)FALSE
2) byName
3) byType
20) Which of these method of Thread class is used to Suspend a thread for a period of time?
1)sleep()
2)terminate()
3)suspend()
4)stop()
21) What does Spring Boot do to simplify the configuration of a Spring-based application?
22) Which of the Blowerng statement is correct regarding the difference mce between TRUNCATE,
DELETE and DROP command
1)DELETE operation can be rolled back but TRUNCATE and DROP dperations cannot be leo back
2) TRUNCATE and DROP operations can be rolled back but DELETE operations cannot be ruled
3) DELETE is an example of DML, but TRUNCATE and DROP are examples of DDL
Options
A) 2 and 3
B) 1 and 3
C) 2 and 4
23) You are given to task to develop a spring boot based web application for a client. The
Functionalities and the schema has been specified by the client. How can you achieve annotation-
based auto-wiring in the application?
24) while working on a project using JPA in java Bob made a class. now he wishes to convert a class
into a entity. which among the following options is needed in order to convert it.
Statements
Options
1) 1
2) 2
3) 3
4) All of these
25) What is the default logging implementation offered by spring boot?
1) By using Log4j
3) By using SLF4J
Table: prostac
Bcode
p_name
Paul
John
Mary
Lisa
Anita
Tara
Price
1015
15.99
15.50
25.25
30.33
15.55
Which of these SQL queries must be used to round off the price to one decimal place in the above
product table?
Statements
Options
1) 1
2) 2
3) 3
4) all of these
27)Suppose you are on developing spring boot applications. You want to use the spring cloud . But
the application needs to handle heavy traffic. You have to implement load balancing. From the above
info, which method is used to implement it in the spring boot?
1) Cloudload
2) Netflix Ribbon
3) RR balancer
4) Can't implement
28) WebServiceTemplate provides a sendSourceAndReceiveToResult() method that accepts
arguments:- //doubt
a)java.xml.transform.Source
b)java.xml.transform.Result
c)java.xml.transform.Template
d)java.xml.transform.JDBCTemplate
29) Ben wants to use the ApplicationContext IoC container in one of his programs during
development. What classes would can be use for the implementation for the applicationContext?
1) AdvancedApplicationContext, FileApplicationContext
3) FileSystemApplicationContext, ClassPathApplicationContext
4) FileSystemApplicationContext, ClassPathApplicationContext,
WebApplicationContext
30) John wants to develop an application in java language. He wants to use the spring boot which is
very flexible and secure. He wants to run his application without relying on an external web server
and reduce the number of executions. Since he used the spring boot framework, it provides the
default project dependencies as well a allows for defaults to be overwritten. Which among the
following features does spring boot annotation include?
1) SpringBootApplication
2) EnableAutoConfiguration
3) ComponentScan
Statements
1) int is used for floating-point numbers, while double in used for integers
3) int is a signed data type that can hold values from 2,147,483,648 to 2,147,483,647 while double is
a floating-point data type tat can hold very large and very small numberd with the decimal places
4) int is a floating-piont data type that can hold very large and very small numbers with decimal
places, while double is a signed data type that can hold values from -2, 147,483,648 to 2,147,483,647
Options
1)1
2)2
3)3
4)4
32) In CSS, which of these properties helps specify the positioning area of a backend veget
1) background-origin
2) background-origin-area
3) background-position-area
4) None of these
33) Which source code management plugin does Jenkins install by default?
2) GIT
3) SUBVERSION
34) John is setting up the credentials in a jenkins system. The credentials are to be added from a
pipeline project. Then what will be choose under this condition
1) System
2) Global
3) Host
4) Server
35) Which of the following rules should be considered while deploying a Microservice-oriented
architecture?
3) Each service unit of the entire application should be the largest and capable of delivering one
specific business goal
4) All of these
36) Which among the following classes is considered as an entry point to an Spring Web MVC
project?
1) DispatcherServlet
2) Dispatch Servlet
3) SpringDispatcherServiet
4) SpringDispatchServlet
37) An organization is required handle 0.96million people every second, in order to control their
heavy traffic, the organization redirects at the all the traffic from one register required to perform the
Y-axis scaling in this scenario to overcome this hindrance then, which of the following action need to
be performed?
1)Run the single server with the same application at a different time.
2) Run the multiple servers with the same application at a different time
3) Run the single server with the same application at the same time.
4) Run the multiple servers with the same application at the same time.
1) Weaving is the process of linkong an aspect with other application types or objects to create an
advised object
2) It is an expression that is matched with yom points to determine whethes, advice needs to be
executed or not
3) It is the process of creating an object after applying advice to the target object
4) None of these
40) In Spring, which of the following methods is not supported by the Thread class?
41) John is working on java. While working on an application, he wants skip the current iteration of a
loop and move for the next iteration without executes body for the current iteration. Help him to
find which of the following can be used in the above-mentioned context.
1) break
2) exit
3) continue
42) Ben decided to use the PUT method in his REST API web service. Which of the following is the
reasons to use it in application //doubt
Reasons :
1) 3 only
2) 1 and 3 only
3) 2 and 3 only
4) 1,2 and 3
43) In an application , Ben has designed several endpoints but for just validation purposes, he wants
to know the methods allowed for a particular URL. The endpoint URL is "/store".Which of the
following methods would use to achieve this
1) PATCH
2) GET
3) OPTIONS
4) TRACE
1)@Controller
2)@RestController
3)@Service
4)@Data
47)Which among the following is not valid Spring Core Framework annotation
1)@PreDestory
2)@PostConstruct
3)@PropertySource
4)@ComponentSource
48) In RESTful web services, you are working on REST based architecture. Which of the following
statements about the HTTP methods that are used in this architecture are correct?
Statements:
4. The PUT method is used to update an existing resource or create a new resource
1)1,2and 3
2) 2,3 and 4
3) 1,2 and 4
4)1, 3 and 4
49) Alice is working on a project on a java J2EE. While writing the code for the required application ,
servlet installation fails. What exception will be thrown for the failure
1) IOException
2) ServletExceotion
3) RemoteException
4) HttpException
50) In REST API. web services, which of these methods is used to remove configuration on a device in
the following
HTTP___/devices/(id)/configurations/(id)
1) POST
2) DELETE
3) OPTIONS
4) PUT
51) What is the name of the thread in output in the following Java program?
class multithreaded_programming
Theard t = Thread.currentThread();
System.out.println(t.isAlive());
}
Options:
1)0
2)1
3)True
4)False
class Hacker{
return a*b/a;
return a*b/c;
class Hackeroverload{
System.out.println(Hacker.add(4,6));
System.out.println(Hacker.add(2,4,6));
Options:
1)6
2)1
3)4
8
4)6
class printhack {
return this.name;
this.name = name;
class Main {
d.setName("Hacker");
System.out.println(d.getName());
d.setName("earth");
System.out.println(d.getName());
Statements:
1)Hacker
2)earth
3)Hacker
Earth
4)Error
OPTIONS:
1)1
2)2
3)3
4)Error