REST Assured Objective Questions:
1) A tester wants to assert a positive and negative test cases for a resource using status
code returned by the server, which following method will help him in fetching the
same? (assume res is the reference for the response object and req is the reference for
the request object returned by the server),
Ans: a) res.getStatusCode()
b) res.getStatusLine()
c) req.getStatusCode()
d) req.getStatusLine()
2) Which of the following patterns are used in Microservices to build a fault tolerant
system when key service has high latency.
Ans: a) API Gateway pattern
b) Circuit Breaker
c) REST Call
d) None of the above
3) In the following code, add XLS workbook close code.
XSSFWorkbook wb = new XSSFWorkbook(fis);
XSSFSheet sheet = wb.getSheetAt(0);
int rowNo = sheet.getLastRowNum() – sheet.getFirstRowNum();
Ans : a) xls.close()
b) close()
c) wb.close()
d) sheet.close()
4) Which of the following statement(s) is/are true about HTTP Request ?
Ans: a) HTTP Request header for containing the information about the data.
b) HTTP Request body that contains the representation of the resources in use
c) Both a and b
d) None of the above
5) Which of the following HTTP method(s) return status code 204 if there is no content in
the body after a successful execution ? (Choose two)
Ans: a) OPTIONS
b) GET
c) DELETE
d) PUT
6) In the following code snippet, identify the correct output after executing the code.
Assume that actual response received is “HTTP/1.1 200 OK”
Response response:
String expResponse = new String(“HTTP/1.1 200 OK”)
response =
RestAssured.get(“http://exampleurl:8081/EDUBank/AccountAPI/getAccount?accountN
umber=44332860268801”);
int statusCode = response.getStatusCode();
String actResponse = response.getStatusLine();
System.out.println(actResponse.substting(0,8));
Ans: a) HTTP/1.1 200 OK
b) 200 OK
c) HTTP/1.1
d) 1.1 OK
7) Pick the correct set of statements for a monolithic application given below.
(a) A monolithic application is self-contained
(b) It is not possible to scale up a specific functionality
(c) All the functionalities are interconnected.
(d) All the functionalities are loosely coupled.
(e) It can incorporate different technologies for different functionalities
Ans: c, b and e
a, b and c
c, d and e
a, b and d
8) Which of the below database pattern get the data from different microservices and
aggregate them instead of performing table join ?
Ans: a) API composition
b) DB Per service
c) Single DB
d) CQRS
9) Statelesness of the service is achieved in which category ?
Ans: a) Logging
b) Messaging
c) Caching
d) Monitoring
10) Which of the following statement(s) is/are true about difference between monolithic
and microservices ?
Ans: a) Microservices are packaged as a single EAR/MSBuild file
b) Monolithic services are packaged as Multiple JAR/DLL files
c) Both A and B
d) Neither A nor B
11) Which of the following is the best option for converting the json object returned by the
server into a User defined java object ?
Ans: a) Make use of json path and then get all the key value pairs of the json object and set it to
the corresponding java object as attributes.
b) Make use of getObject(path, ClassName) method of Json path which will automatically
convert it to User defined object java.
c) Make use of get(path) method of Json path which will automatically convert it to User
defined object java.
d) Make use of get(path, ClassName) method of Json path which will automatically convert
it to User defined object java.
12) Which of the following statement(s) is/are true about characteristics of microservices ?
Ans: a) Maintains separate Development and Maintenance Team
b) Run the development as Product but not as Projects
c) Decoupling is possible in microservices using Smart Endpoints
d) Decentralized Data Management
13) Which among the below is capable of tracking, discovering and monitoring the
microservices ?
Ans: a) Turbine
b) Sleuth
c) Eureka Dashboard
d) Hystrix
14) Data is coming from one AccountXLS in which 1st column has account number value.
Select the correct code which can get account number from XLS.
Assume that this xls has only one row.
Ans: a) String accno= sheet.getRow(1).getCell(0).getStringCellValue();
b) String accno= sheet.getRow(0).getCell(0).getStringCellValue();
c) String accno= sheet.getRow(0).getCell(1).getStringCellValue();
d) String accno= sheet.getRow(1).getCell(1).getStringCellValue();
15) Pick the challenges faced in microservice application.
(a) Managing databases becomes increasingly difficult.
(b) Coordinating with external services or 3rd party API is a challenge.
(c) It is possible to scale up a specific service.
(d) Testing microservices is a challenge as one microservice may depend on data from other
microservices.
(e) All the functionalities are loosely coupled.
(f) Since each service may use different
Ans: a) c, a, f and e
b) a, b, e and f
c) c, b, d and e
d) a, b, d and f
16) In the following code, fill the missing part:
Eam file01 = new FileInputStream(&blank______);
Ans: a) file path
b) file type
c) file size
d) file permission
17) It is Possible to import feature files into iFAST to create test case ?
Ans: a) True
b) False
18) A developer wants to create a resource that can provide an interface for the deleting
some of the records from the server, which of the following HTTP method should be
used for achieving the same ?
Ans: a) GET
b) DELETE
c) POST
d) PUT
19) Which is invalid logging level in iFast ?
Ans: a) Warning
b) Info
c) Exception
d) error
20) Which of the following statement(s) is are false about implementation of
microservices?
(a) Ease of Deployment
(b) Better for Large Teams
(c) Tightly coupled
(d) Domain Driven Design
(e) Useful for highly agile applications
Ans: a) a, c, d
b) b, d, e
c) c, d
d) b, c
21) Rakesh wants response in XML format from the server. What is the header he needs to
create to achieve the same ?
Ans: a) header key = ”Accept” and value=”application/xml”
b) header key = ”Content-type” and value=”application/xhtml”
c) header key = ”Content-type” and value=”application/xml”
d) header key = ”Accept” and value=”application/xhtml”
22) Pick the challenges faced in microservice application
(a) Managing databases becomes increasingly difficult
(b) Coordinating with external services on 3rd party API is a challenge
(c) It is possible to scale up a specific service
(d) Testing microservices is a challenge as one microservice may depend on data from other
microservices
(e) All the functionalities are loosely coupled
(f) Since each service may use different technology stack, deploying them also becomes a
challenge
Ans: a) c, a, f, and e
b) a, b, e, and f
c) c, b, d, and e
d) a, b, d and f
23) Which of the following is/are the challenges of microservices ?
Ans: a) Troubleshooting challenges
b) Maintain transaction safety
c) Services cannot be decoupled
d) Difficulty in debugging
24) Defect can be raised in iFast using
Ans: a) ALM
b) JIRA
c) BugZilla
d) Rational ClearQuest
25) Which tab is used to create & manage external properties like Proxy and Queue in
iFast?
Ans: a) Plan Test
b) manage payload
c) manage configuration
d) Suite
26) In the below code, identify one among the highlighted lines that would be responsible
for unsuccessful execution.
RestAssured.baseURI = http://sampleurl8081/EDUBank/AccountAPI”; Line-1
RequestSpecification request = RestAssured.given((“Content-Type”, “application/xml”); //Line-3
JSON Object reqObj = new JSONObject(Obj.put(“acccountNumber”, “443328602688019”);
reqObj.put(“accountHolderName”, “John A”);
reqObj.put(“ifsc”,”EDUB0000501”);
request.body(reqObj.toString());
Response response = request.post”/accountVerification”); //Line-4); ); // Line-2
Ans: a) Line-1
b) Line- 2
c) Line-3
d) Line 4
27) Which is valid way to create parameters in payload in iFast ?
Ans: a) #{paramName}
b) %{#paramName}
c) ${#paramName}
d) ${paramName}
28) Which one is not a valid way to create the payload request in iFAst ?
Ans: a) WSDL file fetch
b) Import Swagger
c) JSON request
d) Request File Location
29) Which of the following code will have return type that can contain key-value pairs ?
Ans: a) getHeaders()
b) getStatusCode()
c) getStatusLine()
d) All of the above
30) From the following code snippet, predict the output:
Assume that actual response received is “HTTP/1.1 200 OK”
Response response;
Response = Rest
Assured.get(“http://exampleurl8081/EDUBank/AccountAPI/getAccount?accountNumber=4433
28602688019”);
e = response.getStatusLine();
System.out.println (“result is – “+ s2.toLowerCase().contains(“ok”));
Ans: a) result is – OK
b) result is – ok
c) result is – false
d) result is – true
31) Configuration of test data in iFast test case is done in which tab ?
Ans: a) configuration
b) Plan test
c) Data
d) Suite
32) Which of the below testing is done for checking whether microservice is able to respond
back with the right format ?
Ans: a) Unit test
b) Contract test
c) Integration test
d) Component test
33) Which among the below deployment pattern if applied may face difficulty in monitoring
resources consumed by different services ?
Ans: a) Single service per container
b) Multiple service per host
c) Single service per host
d) All the above
34) Which of the following statement(s) on XML and JSON is/are correct ? (Choose two)
Ans: a) Both XML and JSON provide namespace
b) XML is more secured than JSON
c) JSON files are easy to read and interpret compared to XML files
d) Both XML and JSON uses end tags
35) Which of the following are used to develop and deploy microservices ?
Ans: a) Platforms
b) servers
c) Containers
d) None of the above