-->

Featured

DSA Interview Question

Question: Various S orting algorithms Answer: There are various sorting algorithms, each with its own advantages and disadvantages in terms ...

RestAssured API

Question : What does the acronym "REST" stand for?

Remote Execution of Stateful Transactions

Representational State Transfer

Resourceful Endpoint Service Technology

Reliable Stateful Transactions

Correct Answer :Representational State Transfer


Question : Which HTTP method is typically used for retrieving a resource in a RESTful API?

POST

GET

PUT

DELETE

Correct Answer :GET


Question : In REST, what does the term "resource" refer to?

A representation of data

An API endpoint

A database table

A programming language

Correct Answer :A representation of data


Question : Which status code indicates a successful HTTP GET request in REST?

200 OK

201 Created

404 Not Found

500 Internal Server Error

Correct Answer :200 OK


Question : What is the primary purpose of the "Content-Type" header in an HTTP request or response?

Specify the type of authentication

Define the character encoding

Indicate the type of data being sent or received

Determine the cache control settings

Correct Answer :Indicate the type of data being sent or received


Question : In RESTful APIs, what is the purpose of the "URI" (Uniform Resource Identifier)?

To define the programming language used

To identify resources and their location

To specify the authentication method

To handle error responses

Correct Answer :To identify resources and their location


Question : Which HTTP method is typically used for creating a new resource in a RESTful API?

POST

GET

PUT

DELETE

Correct Answer :POST


Question : What does the term "idempotent" mean in the context of RESTful APIs?

The ability to create multiple resources with the same identifier

The ability to perform an operation multiple times with the same result as if it were done once

The requirement for strong authentication

The process of handling errors gracefully

Correct Answer :The ability to perform an operation multiple times with the same result as if it were done once


Question : Which HTTP status code is commonly used for resource not found in a RESTful API?

200 OK

201 Created

404 Not Found

500 Internal Server Error

Correct Answer :404 Not Found


Question : What is the purpose of the "OPTIONS" HTTP method in RESTful APIs?

Retrieve resource data

Update a resource

Retrieve metadata information about the resource

Delete a resource

Correct Answer :Retrieve metadata information about the resource


Question : Which authentication method is commonly used in RESTful APIs for secure communication?

OAuth

Basic Authentication

Token Authentication

API Key Authentication

Correct Answer :OAuth


Question : What does HATEOAS stand for in the context of REST architecture?

Hypermedia As The Engine Of Application State

Highly Accessible Transfer Environment for Object Serialization

Hypertext Application Transfer Endpoint Architecture Specification

Heterogeneous Architecture for Transaction Execution Over Asynchronous Systems

Correct Answer :Hypermedia As The Engine Of Application State


Question : Which HTTP method is used to update a resource in a RESTful API?

POST

GET

PUT

PATCH

Correct Answer :PUT


Question : What is the primary purpose of the "Accept" header in an HTTP request?

To indicate the content type of the request

To specify the response format the client can accept

To define the character encoding

To provide authentication credentials

Correct Answer :To specify the response format the client can accept


Question : What is the significance of the "statelessness" principle in RESTful architecture?

Every request from a client contains all the information needed to understand and process the request

The server must store the state of each client to handle subsequent requests

Clients are required to maintain the state of their interactions with the server

Servers must remember the state of each resource to handle requests efficiently

Correct Answer :Every request from a client contains all the information needed to understand and process the request


Question : Which HTTP method is used to partially update a resource in a RESTful API?

POST

GET

PUT

PATCH

Correct Answer :PATCH


Question : What is the purpose of the "ETag" header in HTTP responses?

To specify the encoding of the response

To provide caching information

To indicate the type of authentication used

To define the character set of the response

Correct Answer :To provide caching information


Question : In REST, what does the term "Uniform Interface" refer to?

A standardized way to authenticate requests

A set of conventions that, when applied to resources, results in a uniform and predictable way to interact with those resources

A specific programming language used for API development

A mechanism for encrypting data during transmission

Correct Answer :A set of conventions that, when applied to resources, results in a uniform and predictable way to interact with those resources


Question : Which status code indicates a client error in a RESTful API, typically due to malformed requests?

200 OK

201 Created

400 Bad Request

404 Not Found

Correct Answer :400 Bad Request


Question : What is the purpose of the "Cross-Origin Resource Sharing" (CORS) mechanism in the context of RESTful APIs?

To prevent the use of API resources by unauthorized clients

To enable or restrict access to resources based on the origin of the requesting client

To encrypt data transmitted between the client and server

To define the format of the resource representation

Correct Answer :To enable or restrict access to resources based on the origin of the requesting client


Question : What is REST Assured primarily used for in Java?

Database operations

Front-end development

API automation testing

File manipulation

Correct Answer :API automation testing


Question : Which HTTP method is commonly used with REST Assured to perform a GET request?

post()

get()

put()

delete()

Correct Answer :get()


Question : In REST Assured, what is the purpose of the given(), when(), and then() methods in the testing flow?

Defining request parameters, making the request, and validating the response

Handling exceptions, logging, and printing output

Initializing variables, running tests, and generating reports

Creating test data, executing test cases, and cleaning up resources

Correct Answer :Defining request parameters, making the request, and validating the response


Question : Which of the following is used to set the base URI for REST Assured tests?

base()

baseUri()

setBaseURI()

setBase()

Correct Answer :baseUri()


Question : How do you specify the query parameters in a REST Assured request?

Using the queryParams() method

Appending them to the URL

Using the queryParam() method

Using the params() method

Correct Answer :Using the queryParam() method


Question : What is the purpose of the extract() method in REST Assured?

Extracting data from the request body

Extracting data from the response body

Extracting data from the headers

Extracting data from the URL

Correct Answer :Extracting data from the response body


Question : Which method is used to send a POST request with JSON payload in REST Assured?

post()

sendPost()

postJSON()

sendJSON()

Correct Answer :post()


Question : How do you validate a JSON response using REST Assured?

Using validate()

Using assert()

Using check()

Using verify()

Correct Answer :Using validate()


Question : What is the purpose of the statusCode method in REST Assured?

Setting the HTTP status code for a request

Extracting the HTTP status code from a response

Verifying the expected HTTP status code

Ignoring the HTTP status code

Correct Answer :Verifying the expected HTTP status code


Question : Which method is used to send a DELETE request in REST Assured?

delete()

sendDelete()

remove()

sendRemove()

Correct Answer :delete()


Question : How do you handle authentication in REST Assured for an API that requires a token?

Using the auth() method

Appending the token to the URL

Using the header() method

Using the oauth() method

Correct Answer :Using the header() method


Question : What is the purpose of the contentType() method in REST Assured?

Setting the character encoding

Specifying the expected response content type

Defining the request body content type

Configuring the request timeout

Correct Answer :Defining the request body content type


Question : How do you perform path parameter substitution in REST Assured?

Using the pathParam() method

Appending them to the URL

Using the param() method

Using the setPathParam() method

Correct Answer :Using the pathParam() method


Question : Which method is used to set a request header in REST Assured?

setHeader()

header()

addHeader()

requestHeader()

Correct Answer :header()


Question : What is the purpose of the log() method in REST Assured?

Logging request details

Logging response details

Logging both request and response details

Controlling log levels

Correct Answer :Logging both request and response details


Question : Which method is used to perform assertions on the response body in REST Assured?

assertThat()

verifyThat()

checkThat()

expectThat()

Correct Answer :assertThat()


Question : What does the hasItems() method do in REST Assured?

Checks if the response contains specific items

Adds items to the request

Validates the HTTP status code

Sets the base URI

Correct Answer :Checks if the response contains specific items


Question : How do you perform content verification in REST Assured for a response containing JSON data?

Using content().json()

Using content().verifyJson()

Using check().jsonContent()

Using verify().json()

Correct Answer :Using content().json()


Question : What is the purpose of the relaxedHTTPSValidation() method in REST Assured?

Enabling strict HTTPS validation

Disabling HTTPS validation

Relaxed validation for HTTPS certificates

Specifying a custom SSL context

Correct Answer :Relaxed validation for HTTPS certificates


Question : Which method is used to set the base path for REST Assured tests?

basePath()

setPath()

withPath()

baseURI()

Correct Answer :basePath()


Question : What is the purpose of the formParam() method in REST Assured?

Sending data in JSON format

Setting form parameters in a request

Verifying form fields in the response

Generating form-based authentication tokens

Correct Answer :Setting form parameters in a request


Question : How do you perform response time validation in REST Assured?

Using check().responseTime()

Using assertThat().responseTime()

Using validate().responseTime()

Using verify().responseTime()

Correct Answer :Using validate().responseTime()


Question : What is the purpose of the rootPath() method in REST Assured?

Setting the base path for requests

Defining the root path for JSON responses

Configuring the root directory for the project

Setting the context root for servlets

Correct Answer :Defining the root path for JSON responses


Question : Which method is used to perform XPath-based validation on XML responses in REST Assured?

assertThat().xmlPath()

validate().xpath()

check().xml()

verify().xpath()

Correct Answer :validate().xpath()


Question : What is the purpose of the with() method in REST Assured?

Configuring request parameters

Handling exceptions

Setting authentication details

Initializing test data

Correct Answer :Configuring request parameters


Question : Which method is used to perform assertions on cookies in REST Assured?

assertThat().cookie()

verify().cookies()

check().cookie()

expect().cookie()

Correct Answer :assertThat().cookie()


Question : How do you perform response body content validation in REST Assured for XML data?

Using content().verifyXml()

Using assertThat().xml()

Using check().xmlContent()

Using verify().content().xml()

Correct Answer :Using assertThat().xml()


Question : What is the purpose of the urlEncodingEnabled() method in REST Assured?

Enabling URL encoding for request parameters

Disabling URL encoding for request parameters

Configuring the URL encoding format

Setting the default encoding for URLs

Correct Answer :Disabling URL encoding for request parameters


Question : Which method is used to perform response header validation in REST Assured?

assertThat().header()

verify().headers()

check().responseHeader()

expect().header()

Correct Answer :assertThat().header()


Question : What is the purpose of the redirects() method in REST Assured?

Configuring the number of allowed redirects

Disabling HTTP redirects

Configuring the redirection strategy

Setting the URL for redirection

Correct Answer :Configuring the number of allowed redirects

No comments:

Post a Comment

popular posts