0% found this document useful (0 votes)
33 views8 pages

Real MCQ

The document contains a series of multiple-choice questions and code snippets related to programming concepts, particularly in Java and Spring Boot. It discusses various exceptions, annotations, and data handling methods, along with assertions and database queries. Additionally, it includes examples of URL handling and data manipulation in a coding context.

Uploaded by

Shubham Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views8 pages

Real MCQ

The document contains a series of multiple-choice questions and code snippets related to programming concepts, particularly in Java and Spring Boot. It discusses various exceptions, annotations, and data handling methods, along with assertions and database queries. Additionally, it includes examples of URL handling and data manipulation in a coding context.

Uploaded by

Shubham Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

MCQANS.

bt- Notepad
File Edit Format View Help
***********PK***********
1)110 113

fest
void
public validateCustomerNameValid Test3(){
Assertion.assertFalse (Validator.isvalidcustomerName ("Aabel james"));

eTest
public void valldateCus tomerNameVa lidTest4 (){
Assertion.assertEquals(Validator. isValidCustomerName ( "Aabel james"),false);

3{ava-58, Språng-10, spring-20)

4)public class SetDemo{


Main.
Set string> set new HashSet<>()

Set.add ("A");
Set.add("8");
Set.add("C");
Set.add("D");
et.add(°B");
IteratorString itertorset.iterat-set.Iterator();
Wnieiterator.nasnexti
if(iterator.next()=*5°
set.remove(iterator.next())
syso(iterator, next ());

ANSWER ConcurrentMod i ficationException exception will be thrown

5)Time-23:58:15

6)String url -"http://localhost: 5555/citizens/{citizenType}s

7) BANK

Ln 218, Col 57 100% Windows (CRLF) UIF-8


& DELL 1243 AM
R DesktopOneDive-Personal This PC aLibranes
12/23/2022
MCQANS.bt
-

Notepad
File Edit Format View Help
6)String url -"http://localhost : 5555/citizens/{citizenType);

7) BANK

Dank bank name bank_branch


1001 Axis Bank ysore
1002 ICICI Bank Banglore DC
1003 State Bank Of India ysore
1006 Indian Bank Chandigarh DC
*****
7)LoanDTO loanDTO new loanDTO();
loanDTO.
setLoanId (1001);
ANSWER IllegalStateException will be thrown
**************************************************************************************

9)@NamedQuery(name- "Order. findNameByCustomerEmailId", query-"SELECT 0.customerNane FROM Order o WHERE p.customerEmailld=: emailld")

10)PharmacyService constructor called


PharmacyRepository constructor called
PharmacyRepository constructor called

11)Product_id Product name


2001 Laptop
2002 Refrigerator
ANSWER: 2085

12)Your perfomance was satisfactory


Your pertomance was satistactory

13)it will delete batch with batch_ID-1002 from 8ATCHt able and then throw EmptyResultDataAc cess Exception

14)EmployeeDTO[ employeeId-1, [email protected], name-null,designation-Senior Associate]


annotation to path variable
15)Add following employeeId:
Min(value-1000)
@Max(value-9999)
Add @Validated annotation at class level

Ln 218, Col 57 100% Windows (CRLF) UIF-8


1243 AM
Desktop OneDive-Personal &DELL This PC LibrarniesS
D * a12/23/2022 22
MCQANS.bt- Notepad
File Edit Format View Help

*********************************SD *********************************************

16)Earth Mars Saturn

17)[18,36,18,78, 480
18)2022-08-09
19){null-null, A=Avan, B=Bob, C-Catlyn}
20)Linel:@NotNull
ine2:@NotNull @Pattern(regexp-"[A-Za-z]")
Line3:@PatOrPresent

21)Welcome to Spring Boot


Hello Horld
I am Spring Boot Application
*****

22 )which will match the following expression


method pointcut
"execution(private"com.infy.Allocation.find"(. .))*
Answer: All private method of com. infy.Allocation class whose name start with "find", take any number of arguments
--- - ------- - ----------- ------- - - ------------ ---- -

23)it will delete customer with customer_Id 1 from CUSTOMER table and instruments with instrumentname Mouth Organ and Spanish Guitar from INSTRUMENT table
24)restTemplate . delete(url, studentId)

25)110
117
1s Correct ans.

26)option given are:


(a)181-8lowing with the Mind
102-Stand By Me
null-Annie s song
4-Here
the Mind
(B)101-51owing with
102-Stand By Me
()NullPointerException exception will be thrown :CORRECT ANS
(d) null-Annie's song

Ln 218, Col 57 100% Windows (CRLF) UTF-8


Desktop OneDrve- Personal & DELL This PC ALibrarnies 1243 AM
a
* 12/23/2022 2
MCQ ANS.tt -

Notepad
File Edit Format View Help
26)option 8iven are
a w1th the Mind
1owing
102-stand 5y Me
null-Annes son8
164-Here I am

(b)101-Blowing with the Mind


102-Stand By Me will be thrown :CORRECT AHS
(c)Nul1PointerException exception
(d) null-Annie"s song
the Mind
101-Blowing with
102-Stand By e
104-Here I am
(C)IS CORRECT

27)assert Ihrows, assertEquals


***************-----. ***

28)Element at 3rd position : Java-Java


Size:16
- - - - ------------------*****"KB**

29)Transaction code ans

syso(amountList)
option given are:
a)5000.0,56001.4
b)[2800e2 .4]

C2500.0,28000.7]
d)Illegal1StateException exception will be thrown
ANSWER: D)Illega1StateException exception will be thrown
* * * * * * * * * *
- - - - - - - - - - - - - - - - - - - - - - - - - - - -

30)@AfterThrowing (pointcut-"execution ("com. infy. service. 'Impl. (..)",throwing-"exception")


- - - - - - - - - - - - - - - - - - - - - -

31)[email protected]
- *

32) public class DateTester{


public static void main (String Ilargs)
Day0fWeek dayoFWeek Dayofieek.of(7);
sVso(davofWeek) :

Ln 218 Col 57 100% Windows (CRLF) UIF-8


Desktop OneDrive- Personal & DELL This PC Libraries
12/23/2022
MCQ ANS.tt -

Notepad
File Edit Format View Help
31)[email protected]
32)public class DateTester(

public static void main(Stringl]args)


DayorNeek dayofNeek Dayofweek.of(7);
syso(dayOfWeek) ;

ANSWER: SUNDAY
- ---------------------
33)http://localhost: 8080/api/products?id=10818name=Laptop
****
34) QUESTIONhttp://localhost:8765/sellers/1000?
ANSWER ConstraintViolation Exception exception will be thrown
****************** *******

35) AUTHOR:
author
BOT
id name
James
1002 Tom

BOOK:
book1a
a book name auth_1d
Right Thing
2002 Wonderlana 1902
Potter Bloom 1002
2004 ey 1o Success

* * * * *
*************************************

36)1,2,4 option are correct.

@Query("select p from Product p where p.manufacturedDate> ?1")


List<Product>findByDate (LocalDate date);
@Query("select p from Product p where p. manufacturedDate> : mdate")
ListProduct>find8yDate(CParam("mdate" )LocalDate mdate);
&

ListeProduct>findByManufac turedDat eAfter ( LocalDate date) :

Ln 218, Col 57 100% Windows (CRLF) UTE-8


Desktop OneDrive- Personal &DELL This PC Librarnes
12/23/2022
MCQ ANS.bxt Notepad
-

File Edit Format View Help


2 2003 Potter Bloom O02
Key 1o Success 1002
*******************

36)1,2,4 option are correct.

@Query( select p from Product p where p.manufacturedDate> ?1")


List Product>findBybate(LocalDate date);

Query("select p from Product p where p.manufacturedDate> : mdate")


ListProduct>findByDate(@Param("ndate")LocalDate mdate)

ListProduct>findByManufacturedDateAfter(LocalDate date);
- - - - - - - - - *

- ********
37)Name-Honica will be displayed and Nul1PointerException will be thrown
- - -

38)Before: [ John, Joe, Sam] After: (John, Sam]


* * * * * * * - - - -

39)Assertion. assertEquals(true, citizen. isVoter (18));

-
Assertion. assertFalse(citizen.isVoter(17));
------.-.. -------*****sY************
40)LocalDate localDate-LocalDate of (2020, 8, 12)
ANSWER: 2022-08-09
.

41) 1,4 option are corfect.i


oneToMany(cascade = Cascade Type.ALL)

ejoincoloumn(name="stream_id"
&

@OneToMany(cascade CascadeType.ALL)
ejoincoloumn(name="stream_id", unique-true)
- -

42)sequence_name next_v
cust

Ln 169, Col 20 100% Windows (CRLF) UIF-8


1246 AM
DesktopOneDrive -Personal &DELL This PC aLibranes
R a * G 12/23/2022
MCQANS.t
-

Notepad
File Edit Format View Help
36)1,2,4 option are correct.

@Query("select p from Product p where p.manufacturedDate> ?1")


ListProduct> findBybate(Loca lbate date);
@Query("select p from Product p where p.manufacturedDate>: mdate")
ListProduct>findByDate(@Param("mdate")Localbate mdate) ;

ListProduct>findByManufacturedDateAfter(LocalDate date) ;
* * * * * * * * * * * *
- - - - - - - - - - .

37)Name-Monica will be displayed and NullPointerÉxception will be thrown

38)Before: John, Joe, Sam] After: [John, Sam]


* * * * * * * * * * * * * * .

***
39)Assertion. assertEquals (true, citizen. isVoter(18) );
Assertion.assertFalse(citizen. isVoter(17)) ;
------- ----*****SY************

40)LocalDate localDate=Loca1Date.of(2020,8,12)
ANSWER: 2022-08-89

41) 1,4 option are correct.


@OneToMany (cascade - CascadeType.ALL)
@joincoloumn (name-"stream_id")

OneToMany(cascade - CascadeType.ALL)

joincoloumn (name-"stream_id", uníque=true)


--*******-******************************|
42) sequencename next v a l

1000
cust
ANSWER: 1081
*******************************

43)2 & 3 option are correct

Ln 218, Col 57 100% Windows (CRLF) UTF-8


1245 AM
DesktopOneDrive- Personal DELL This PC Libraries
a 12/23/20222
MCQ ANS.tat
-

Notepad
File Edit Format View Help

43)2 & 3 option are correct

The value of name attribute in eNamedQuery is correct

In repository @Param annotation is nott required


-
-----------------------

44) http://1localhost : 1111/api/events/C4


-Hall
45)String url "http://localhost : 8765/user/users";
ListuserDTO>userDTOs=restTemplate
**----------
- - - - - - -
. getForobject(url,List.class)
*****SP*****

46)9:59:45
****------

47)invalidAmount ()test case:


Passes, validAmount () test case: Fails
* * * * * * * *

48)@GeneratedValue(strategy GenerationType. IDENTITY)

49)EmployeeDTo[ employee =1,emaild-andreginfy.com, name=null, designation-Senior Associates]


-- ------------** - - - -

50)add following annotation to


ein(value-1000)
path variable employeeId:
Max
dLue-9999)

ed annotations at class level1


51) LocalDate local0ate=LocalDate.of (2812,12, 31) ;
ANSWER: 2013-62-28
---- - - - - - - - - - - -

52)Order Placed Successfully


- - - - - - - - - - - - - - - - - -

53)Line1-@RestControllerAdvice
Line2-@ExceptionHandler(TravelBookingException class) .

*******
4 which of the tollowing method is properly mapped to hand le the http get request with URI /students/S1161
Choose c o r r e c t option.
)9Reaues tMaooina( " / s t u d e n t s / f s t u d e n t I d l " .method -Reaues tMethod . GET)

Ln 218, Col 57 100% Windows (CRLF) UIF-8


Desktop OneDive- Personal Libranes 1245 AM
DELL This PC A * 12/23/20222

You might also like