M CQ 2
M CQ 2
} }
Help her to select the appropriate code from the below options to achieve this task.
CSS is used for describing the presentation of web pages ,including colors layout and fonts
which of these statements are correct with respect to CSS ? css enables presentation and content teams can work simultaneously on independent componenets
<!DOCTYPE html>
<html>
<body>
<h2>Number table</h2>
<script>
function calculate() {
var n=parseInt(document.getElementById("n1").value);
var text="";
var i;
for(i=1; i<=10;i++) {
Dhananjay has been entrusted with the task of creating a webpages. text+=" " +(n*i)+ "<br>";
The webpage will have s text box and a button. }
The user can enter the number using the text box. document.getElementById("demo").innerHTML=text;
On click of the button, request a calculation function to display multiplication table on the webpage as shown in the image. }
Using javascript, calculate mutiplication table of the number entered in the text box. </script>
Select the valid code option which can fulfill this requirement. Enter Number: <input type="text" name="number" id="n1"/>
<br/>
<button onclick="calculate()"> Calculate</button>
<p id="demo"></p>
</body>
</html>
Consider the following JPA code. Where "MoviesData" is persistence unit name in
persistence.xml file.
EntityManagerFactory emfactory=Persistence.createEntityManagerFactory("MovieData");
EntityManager entitymanager = emfactory.createEntityManager();
Query query=entityManager.createQuery("select m.movieName, m.genre,m.language from
A)
MovieEntity m");
List<Object> list=query.getResultList();
// fill the code here
System.out.println("Moviename \t MovieGenre \t MovieLanguage");
for(Object entity : list) {
MovieEntity has the fields String movieName, String genre and String language.
Object[] obj=(Object[]) entity;
Note that Movie table has three rows. Identify only one correct statement from the following
System.out.println((String)obj[0]+"\t"+(String)obj[1]+"\t"+(String)obj[2]);
options to print the movie details as shown.
}
MovieName Movie Genre MovieLanguage
Dunkirk History Spanish
Interstellar Science-fiction French
MI 7 Action and Adventure English
Refer the following JPA code unit1 is the persistance unit name in persistance.xml.
public class MovieDAOImpl{
public void addMovie(MovieBean movie) throws Exception {
EntityManager entityManager = null;
try{
EntityManagerFactory enitityManagerFactory =
Persistance.createEntityManagerFactory("unit1");
enitityManager = enitityManagerFactory.createEntityManager();
MovieEntity movieEntity= new MovieEntity();
MovieEntity.setMovieId(movieEntity.getMovieId());
MovieEntity.setMovieName(movieEntity.getMovieName());
MovieEntity.setMovieGenre(movieEntity.getMovieGenre());
entityManager.getTransaction().begin();
entityManager.merge(movieEnity);
entityManager.getTransaction().commit();
} catch (Exception exception) {
throw exception;
}
finally {
if(entityManager != null) {
entityManager.close();
}.
. i and ii only
.
.
.
MovieDAOImpl impl=new MovieDAOimpl();
imple.addMovie(bean);
MovieBean has fields int movieId. String movieName and String movieGenre. MovieEntity
has fields int movieid. String movieName and String movieGenre. Assume that in MovieTable
no record exists with movieId 1004. A record exists with movie id 1003. Upon
executing the program which of the following statements are true. Choose Two.
A) @BeforeAll
static void beforeAll()
Which Annotations and method signatures are correct in Junit ? [Choose 2]
B) @BeforeEach
void beforeEach()
@ParameterizedTest
@CsvSource(value={"TechVersant@1","TechVersant@2"} , delimeter='@')
void simpleCsv( final String s1 , final int n1) {
assertNotNull(s1);
assertTrue(n1>0);
}
}
public static Connection getDBConnection() throws ClassNotFoundException,
SQLException {
String url="jdbc:mysql://localhost:3306/jdbcdemos";
String username="root";
John is creating a java application for CRM. He wants his application to be connected with
String password="root";
the mysql database to maintain the customer records. Help him to establish connection with
Connection connection=null;
the database.
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(url,username,password);
return connection;
}
Refer the following code Mrs Janet has been asked to code JDBC program to insert
movie details in the movie table columns 'movieid' , 'moviename' , 'genre' and
'language'. Help her to complete the following code by identifying the right set of
statements to be added. Choose one. Note that Mysql database is locally installed . Default
port numner is used. Schema is 'jdbcdemos'. 'Movie' Bean class has fields int 'movieId',
String 'movieName', String 'genre' and String 'language'.
entityManager.getTransaction().begin();
res=query.excuteUpdate();
entityManager.getTransaction().commit();
}
catch(Exception exception) {
throw exception;
}
finally {
if(entityManager!=null) {
entityManager.close();
}
}
}
}
<!DOCTYPE html>
<html>
<body>
<h2>Number table</h2>
<script>
function calculate() {
var n=parseInt(document.getElementById("n1").value);
var text="";
var i;
for(i=1; i<=10;i++) {
Dhananjay has been entrusted with the task of creating a webpages. text+=" " +(n*i)+ "<br>";
The webpage will have s text box and a button. }
The user can enter the number using the text box. document.getElementById("demo").innerHTML=text;
On click of the button, request a calculation function to display multiplication table on the webpage as shown in the image. }
Using javascript, calculate mutiplication table of the number entered in the text box. </script>
Select the valid code option which can fulfill this requirement. Enter Number: <input type="text" name="number" id="n1"/>
<br/>
<button onclick="calculate()"> Calculate</button>
<p id="demo"></p>
</body>
</html>
Which of the following methods in JPA when involed, entity changes to managed state.
Choose TWO
i) Find
i and ii only
ii) Persist
iii) Remove
iv) Merge
Consider the below html:
<h1>Voter Age Validation</h1>
<form action="success"> function voter Age()
Enter your age:<input type="text' id="age"> {
<input type="button" value="Validate" onclick="voterAge()"> var age=parseInt(document.getElementById("age").value);
</form> if(age>=18)
Choose the most appropriate javascript function implementation for voterAge() {
that display an alert message with message "Valid Age" If value entered is 18 and alert("Valid Age");
above and message "Invalid Age" if not entered in the range. }
else {
alert("Invalid Age");
}
}
alechmist @NamedQueries({
harry potter @NamedQuery(name="latest_book",query="select b.bookName from BookEntity b where b.public year IN(select MAX(b.
black beauty publishyear)from BookEntity b)"),
the secret @NamedQueries({
life of Pi @NamedQuery(name="oldest_book",query="select b.bookName from BookEntity b where b.public year IN(select MIN(b.
Davinvi code publishyear)from BookEntity b)"),
@entity
@table(name="book")
public class Bookentity{
@Id
@column(name="bookId")
private integer bookId;
@column(name="book_name")
private string bookName;
private Stringauthor
@entity
@table(name="customer")
public class customerentity{
@Id
private Integer customerId;
private String customerName;
@ManyToOne(cascade="CascadeType.PERSIST)
@JoinColumn(name="locationId_fk") It leads to failure i.e. referntial integrity constraint voilation and exception hence no record is deleted
private locationEntity location;
@Entity
@Table(name="loaction")
pubic class LocationEntity{
@Id
private int locatuonId;
private String city;
Sheila wants to check if a condition in her code is working correctly . Which Junit assert method is appropriate for her? void assertTrue(boolean condition)
which one of the below tag creates boundaries of document header? <head>
void assertTrue(condition)
class.forName("drivercClassName")
It is dependent on database
Which of the following statement is/are valid to register driver class in JDBC?
1) DriverManager.getConnection("driverClassName");
2) DriverManager.registerDriver("driverClassName");
3) DriverClassName obj=new DriverClassName();
2&4
4) Class.forName("driverClassName");
isSearchable()
which of the below is valid XML tag <boby></body>
consider the below XSl file calle Library Transform.xsl with code
<xsl;stylsheet version ="1.0"xmlns = "https://...
<xsl:template match="/">
<html>
<body>
<h1>Library</h1>
<books>
<table border="1">
<book>
<tr>
<isbn>678999</isbn><title>Learning XMI</title
<td>ISBN</td>
</book>
<td>TITLE</td>
<book>
<tr>
<xsl:for-each select="books/book">
<isbn>008999</isbn><title>Learning HTML</title>
<tr>
</book>
</books>
<td><xsl:value-of select-"isbn"/></td>
<td><xsl:value-of select="title"/></td>
</tr>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Which of the below would generate a well formed xml with above x
<book>
<isbn>678999</isbn><title>Learning XMI</title
</book>
Consider the following test case: Consider the following test case:
import java.time.Duration; import java.time.Duration;
import org.junit.jupiter.api.Assertion; import org.junit.jupiter.api.Assertion;
import org.junit.jupiter.ap.Test; import org.junit.jupiter.ap.Test;
class MCQTest{ class MCQTest{
@Test @Test
public void testAssertions(){ public void testAssertions(){
Assertions.assertTimeout(Duration.ofSeconds(1),(){ Assertions.assertTimeout(Duration.ofSeconds(1),(){
Thread.sleep(100); Thread.sleep(100);
}}; }};
Assertions.assertEquals(10,"10"); Assertions.assertEquals(10,"10");
} }
<isbn>008999</isbn><title>Learning HTML</title>
</book>
<html>
<body>
<h2> form </h2>
<form>
Name:<br>
option to create html form, that allow users to enter name,email and gender. must allow to select only one of a given choice
<input type="text" id="fname" name="fname"><br>
male,female and other.
email:<br>
<input type = "text" id="email"name="email></br>
<input type = "radio" id="male"name="gender>value="male">
male<br>
<input type = "radio" id="female"name="gender>value="female">
female<br>
<input type = "radio" id="other"name="gender>value="other">
other</br>
</form></body></html>
box1{
bob has a requirement to style a div element in his webpage to have background color to be red and font style to be italic. background-color red;
below is the div element,help bobselect the most appropriate way to apply styling via CSS. font-style italic;
<div class="box"></div> }
<!doctype html>
<html>
<body>
<h2>number table></h2>
<script>
Dhananjay has been entrusted with the task of creating a webpages. function calculate(){
The webpage will have s text box and a button. var n = parseInt(document.getElementById("n1").value);
The user can enter the number using the text box. var text="";
On click of the button, request a calculation function to display multiplication table on the webpage as shown in the image. var i;
Using javascript, calculate mutiplication table of the number entered in the text box. for(i=1;i<=10;i++){text+=" "+(n*i)+"<br>";}
Select the valid code option which can fulfill this requirement. document.getElementbyid("demo").innerHTML=text;}
</script>
enter number<input type= "text" name=""number"id="n1"/><br/>
<button onclick="calculate()">calculate</button>
<p id="demo"></p></body></html>
In order to establish connection with MYSQL database in JDBC which one of the following connection urls is correct?
note that port number is 3306,schema is test and mysql is locally instead jdbc:mysql://localhost:3306/test
already written in sheet
@test
@disabled
please select the correct ennotation @tag
get
there are a number of http methods.select valid http methods from given list[choose 2] put
Jacqueline wants to create a customer report by fetching customerId, customername and customerlocation from
customer table. Consider CustomerEntity class with the following structure.
@Entity
class CustomerEntity{
@Id
private int customerId;
private String customerName;
private String customerContact;
private String customerLocation;
//Code with getters and setters
}
Help her to select the appropriate code from the given options.
Which of the below statements are correct with respect to HTTP and HTTPS:
1. HTTPS stands for Hyper Text Transfer Protocol Server
2. HTTPS is Combination of HTTP and Secure Socket Layer (SSL) 2nd and 3rd statements are correct
3. The https:// web pages indication along with a lock icon in the browser window pane indicate the presence of a
secure web page.
Ani is working with a house construction application. She created two entity classes House and Window
that helps to design the application. What's true about the following @Entity association
between House and Window?
@Entity
public class Window{
@ld
private int winNo;
private House aHouse;
}
It's One To Many bidirectional association
@Entity
public class House {
@ld
private int houseNo;
@OneToMany(cascade Cascade Type ALL)
private List<Window> windows;
}
Choose the best option
Punith, a developer wants to synchronize the changes done on the CustomerEntity object on the customer table.
He is using the below code to update the changes
Which of the following customer data will be stored/updated in the customer table after executing the above code.
Mr. Gaetano gets following error upon executing the code to retrieve details from the table "movie" with columns
movied, moviename, genre and language. From the following options which one he has to add in line1 in order to fix it.
Note that Mysql database is locally installed. Default port number is used. Schema is jdbcdemos < add movie bean structure>.
Movie Bean class has fieds int movield, Sting movieName, String genre and String language.
Refer the following code
Error:
}
Help her to select the appropriate code from the below options to achieve this task.
Which annotation and method signatures are correct in Junit?
1.Junit 5 supports Java 5 or higher
Which of these statements are incorrect with respect to Junit 5?
2.Junit Jupiter provides support for running Junit 3 and Junit 4 based test on the platform.
3.Annotation @BeforeAll is analogous to Junit 4's @beforeEach
consider BookMyTicket application.It allows users to book movie tickets. JPA is used for persistance
operations. It has two entities MovieEntity with fields int 'movieId', String 'movieame', String 'genere'
and String 'language'. ScreenEntity with field int 'movieId',int 'screenId', String 'screenName', Date
select movie,screen from movieEntity movie,ScrrenEntity screen where Movie.movieid = screen.movieid
'showTime.They share one to one association.You are required to write JPQL to fetch movie name,
genre, language, screen name and show them to give movie id. Which one of the following JPQL
queries is correct?
Consider the following JPA code. Where "Movie Data" is persistence unit name in
persistance.xml file.
EntyManagerFactory emfactory = Persistence.createEntityManagerFactory('MovieData"):
EntityManager entitymanager = emfactory.createEntityManager();
Query query=entityManager.createQuery("select m.movieName, m.genre,m.language from
MovieEntity m"):
List Object list=query.getResultList (); System.out.printin "Moviename It MovieGenre It MovieLanguage
MovieEntity has the fields String movieName, String genre and String language. for (Object entity : list) {
Note that Movie table has three rows. Identify only one correct statment from the following Object) obj=(Object0) entity
options to print the movie details as shown. System.out.prtin((String)objf0]+"r+(String)objf1]+""+(String)obj[2]): }
customer
customer Id customerName locationId_fk
1001 Jack 1
1002 Jim 1
1003 Jai 2
location
locationId city
1 Chennai
2 Pune
3 Banglore
BookEntity.java
------
@Entity
@Table(name = "book")
public class BookEntity{
@Id
@Column(name="book_id")
private Integer bookId;
@Column(name="book_name")
private String bookName;
persistence.xml
-----
<persistence version="2.1"
xmlns="http://xmins.jcp.org/xml/ns/persistence"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name='JPA Merge">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>com.entity.BookEntity</class>
<properties>
1)Runtime exceptio in line-1
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
2)101
<property name="javax.persistence.jdbc.url" value='jdbc mysql:localhost:8306jpa_de" />
3)complilation error in ine-2
<property name='javax.persistence.jdbc.user" value="root"/>
4)Runtime exception in line-3
<property name="javax.persistence.jdbc.password" value="root">
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
Answer: Runtime exception in line-3
</persistence-unit>
<persistence>
BookMain.java
--------
public class BookMain { @EmbeddedId
public static void main(String[] args){ @Embeddable
EntityManagerFactory emf=Persistence Merge"); @NamedQuery
@Qualifier
choose from below INVALID annotation in JPA
Entity Manager em-ent.creaturing
BookEntity book1=new BookEntity(); Answer: @Qualifier
book1.setBookld(101);
book1.setBookNome("Alchemist");
BookEntity book2 em mage book
Book Entity book3 = new Book
book3.setBookName/Secret?
book3.setBookbook
Book Entity boord en meget
em clearl
System.out.println(book4.getbook());
}
}
Predict the output
Mr. Gaetano gets following error upon executing the totale
table'movie' with columns movieid, moename gener
options which one he has to add in lines in order to fant. Noe te pa
locally installed. Default port number is used. Schema is hosteren
structure> Movie Bean class has fields int movield, Sting modelare
String language
Refer the following code.
1-
funcation sum(){
document froms.calc.result.value=
parseInt(document.forms.calc.number2.value)+
parseInt(document.forms.calc.number1.value);
}
2- c)1st
public int getSum(int a int b){
reurn a+b;
}
3-
function int getSum(int a, int b){
return a+b;
}
which of below statements are correct w.r.t http and https
1-
HTTPS stands hyper text transfer protocol server
2nd and 3rd are correct
2-
HTTPS is combination of HTTP and secure socket layer(SSL)
3-
the https:// web pages indication along withlock icon browser window indicate presence of secure web page
Ena and her team is working on UI design of job portal, currently they are designing cadidate registration form.
ena n her team need helps to identify http method that would allow submit registration form details as part of request body
POST
to identify resource. on successful submission of req it would create registration id
please choose appropreiate help request method
QUESTIONS ANSWERS
Choose the disadvantage on thin driver from below options It is dependent on the database
Suresh a marketing executive wants to create an customer report on monthly basis. He wants
to iterate the records from customer table more faster. Help him to select appropriate interface PreparedStatement
for this situation.
Choose from the following CORRECT statements about Class.forName() method call.
This method is used for dynamically loading the driver's class fle into memory and to register it
automatically. I and II only
I) Since JDBC 4.0 this is redundant since auto discovery was enabled.
II) It is used only for loading type 4 driver
Assume that book table is created in book db database and record is inserted as per
below schema
Incomplete Question
EclipseLink
Which of the following are JPA providers ? [choose 2] Hibernate
Which object represents the programmatic connection definition? It also reads
EntityManagerFactory
the connection information from persistence.xml by mapping with the PersistenceUnitName
List Object list=query.getResultList (); System.out.printin "Moviename It MovieGenreIt MovieLanguage
for (Object entity : list) {
Considerthe following JPAcode. Where “MovieData”is Persistence unit name in persistance.xml Object) obj=(Object0) entity
file. System.out.prtin((String)objf0]+"r+(String)objf1]+""+(String)obj[2]);
@NamedQueries{
@NamedGAry(name="query1"query "select b from BookEntity b),
Choose from below VALID named queries annotation in JPA
@NamedQuery(name="query2"query = "select b.bookld from BookEntityb')
})
What type of testing is done using Junit? Unit testing
Anil is explaining JUnit 5 assumptions to his team. Which one of the below statements is false
Failed assumptions result in a test failure
with respect to assumptions and assertions?
Consider the following test case:
class McqTests {
Assertion results in a test failure because of -
@Test AssertionFailed Error. expected.
public void testAssertions() { java.lang.Integer but was: java.lang.String
jack want to delete a customer(customerId = 1001)from a customer table,since customer is notactive for longer time he is
using the below code to delete the customer recoed .consider persistance unit is" unit1".
@Entity
class CustomerEntity{
@Id
int customerId;
String customerName;
//Generate getters and setters}
class CustomerDao(
public voud deleteCustomer(){ removed
try{int id = 1001;
EntityMnagerFactory entityManagerFactory = Persistance.createEntityManagerFactory("unit1");
EntityManager entityManager = entityMnagerFactory.createEntityManager();
entityManager.getTransection().begin();
employeeEntity = entityManager.find(EmployeeEntity.class,id);
if(id== employeeEntity.getEmployeeId()){
entityManager.remove(emploeeEntity);
entityManager.getTransection().commit();//line-1}
else{system.out.println("employee id doesn't exist!");}}
catch(Excepetion exception){exception.printstackTrace();}}
observe the aboue code and find out entity object goes to which state after line-1
ena and her team is working on UI design of a job portal. currently they are designing a candidate registration form.ena and post
her team needs a help to identify the Http method that would alow submit th registration form details as part of request body
to identified resourcses on successful submission of request it would create a registration id.please choose the most appropriate
http request method
Consider css and html code in mystyle.css and index.html file as below:
mystyle.css:
.center(
color:red;
background-color:yellow;}
index.html:
<htmml><head> <link rel = "stylesheet" type="text/css" href ="mystyle.css">
>!-line3->
</head><body>
<h1 class = "center">java</h1>
<p class = "center"> java is a popular programming language,created in 1995>/p>
</body></html>
which one of the below lines,if placed at line 3 in index.html,will use css style from mystyle.css inside index.html
Consider Becky wants to perform update on price and author name by book id on book table
Refer BookEntity class below:
@Entity @Table(name="book") public class BookEntity{
@Id @Column(name="book_id") private Integer bookld; @Column(name="book_name") private String bookName;
private String author,
private Double price; @Column(name="publishyear") private Integer publishYear:
//getters and setters
Refer table Book data below :
ID Book Name Author Price Publish Year
1 Alchemist paulcoelho 250$ 1988
2 Davinci code Dan Brown 250$ 2003
3 Harry potter J.K rowling 250$ 1998 Query query = entityManager.createOuery("update BookEntity k set k.prlce=?11 and k.author-?21 where k.book_id = :Id");
4 black beauty Anna sewell 250$ 1877 query.setParameter(11,200.0);
5 the secret rhonda byrne 250$ 2006 query.setParameter(21, "Shakespeare");
6 life of pi yann martel 250$ 2001 query .setParameter("id",1);
consider the code structure below:
class bookUpdateExample{p.s.v.main(String[] args){
integer res = null;
try{EntutyMangerFactory entityMnagerFactory = persistence.createEntityManagerFactory("pu");
entityMnager = entityMnagerFactory.createEntityManager();
/**line-1:code goes here**/
entityMnager.getTransection().begin();
res = query.excecuteupdate();
Eesha wants to add a new customer record in a customer table.
Consider the CustomerEntity with the below structure,
class CustomerEntity{
int customerid;
String customerName;
String customerLocation;
String customer Type;
//Generate getters and setters
}
Help her to select the appropriate code from the below options to acheive this task.
Choose from below VALID named queries annotation in JPA.
Mr.Gaetano gets following error upon executing the code to retrieve movie details from the
table 'movie' with columns movieid, moviename, genre and language. From the following
options which one he has to add in line1 in order to fix it. Note that Mysql database is
locally installed. Default port number is used. Schema is jdbcdemos <add movie bean
structure> Movie Bean class has fields int movield, String movieName, String genre and
String language.
Refer the following code.
@NamedQueries({
Choose from below VALID named queries annotation in JPA. @NamedQueries @NamedGAry(name="query1"query "select b from BookEntity b),
@NamedQuery(name="query2"query = "select b.bookld from BookEntityb')
})
Jack wants to delete a customer(customerld 1001) from a customer table , since customer is not
active for longer time. He is using the below code to delete the customer record.Consider
persistance unit is "unit1".
@Entity
class CustomerEntity {
@Id
int customerld;
String customerName;
//Generate getters and setters
} Managed (ans in pdf is Removed ...need to just verify)
class CustomerDao {
public void deleteCustomer() {
try {
int id=1001;
EntityManagerFactory entityManagerFactory =
Persistence.createEntityManagerFactory('unit1");
EntityManager entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
employeeEntity = entityManager.find(EmployeeEntity.class.id);
if (id == employeeEntity.getEmployeeld()) {
entityManager.remove(employeeEntity);
entityManager.getTransaction().commit();//line - 1
}
else{
System.out.printin("employee id doesn't exist!");
}
}
catch(Exception exception) {
exception.printStack Trace();
}
}
Observe the above code and find out entity object goes to which state after line - 1
What type of testing is done using Junit? Unit Testing
What JDBC stands for? Java Database Connectivity
What is JDBC?
Which of the following is not a component/class of JDBC API? Transaction
Which of the following is not a component/class of JDBC API? ConnectionPool
A - JDBC DriverManager is a class that manages a list of database drivers.
B - It matches connection requests from the java application with the proper database driver using
Which of the following is correct about DriverManager class of JDBC?
communication subprotocol.
Ans: Both
A - JDBC driver is an interface enabling a Java application to interact with a database.
B - The JDBC driver gives out the connection to the database and implements the protocol for transferring the
Which of the following is correct about driver interface of JDBC? query and result between client and database.
Ans: Both
class McqTests {
@Test
public void testAssertions() {
String sValue1= new String("TechGenics");
String sValue2= "TechGenics";
//Line 3
Assertions.assertEquals(sValue1, sValue2);
}
}
}
Which one of the below assertions, if placed at Line 3 in above code, will result into sucessful for
execution.
1. Assertions.assertSame(sValue1, sValue2);
2. Assertions.assertEquals(sValue1, sValue2);
Mr.Fred is a curator of the chain of museaums owned by the government. He is unsing a jaba
application names publicomuseo to store,retrive and modify artifect deatils in tnames hose museaums.
Mr. Martin runs an event management company names gastinodevents.Both have joined hands to the host
events
in those museaums to ignite interest among the public.Assuming that application uses JPA for persistance Many to one
operartions
which type of association exists between museum entity and Event entity.Choose one.
In JPA,JPQL queires are transiated byJPQL query processor.Consider the following sql statement
select * from MovieDetails.
Select m from MovieEntity m
From the following identity the equivalent JPQL statement.Note that table is MovieDetails
and entity is MovieEntity.
which of the following is/are valid to register driver class in JDBS?
1)DriverManager.getConnection("driverClassName");
2)DriverManager.registerDriver("driverClassName"); Class.forName("driverClassName");
3)DriverClassName obj=new DriverClassName();
4)Class.forName("driverClassName");
EntityManagerFactory provider name Has connection information,entity names and persistance
EntityManager data from a A logical collection of data for storing,manipulating and retriving database
1-iii,2-iv,3-ii,4-i
Entity connections Represents the programmatic connection templete for creating
persistance.xml Manages entities and performs CRUD operations
@test,
please select the correct annotations @desabled
@tag
create
which of the following options are valid for property " hibernate.hdm2ddi.auto" update
create-drop
org.junit.jupiter.api.test
harish and team is writing is writing a junit5 based test cases.help them to identify,which annotation.... method .....................................
..........................some code below
Yash task is to update the customer record using JPQL so he was writing update statement and passed to the createQuery()
method, then he realised that its not a good practice to pass query string while creating queries. He would like to use namedQuery
Answer:- B) Parameter cannot be passes to a named query to do the operation on required data set
for this approach. Help him to identify wrong statement about NamedQuery.
Predict the output of following program:
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class McqTests{
@Test
public void TestAssertions(){ Assertion fails and displays the supplied failure message “condition is true”
int iValue1 = 200;
int iValue2 = 200;
preparedStatement1.setInt(1,1);
preparedStatement1.setString(2, "Book1");
preparedStatement1.setDouble(3, 100.0);
count = preparedStatement1.executeUpdate();
}
}
}
In JPA, JPQL queries are translated by JPQL query processor. Consider the following SQL statement:
From the following identify the equivalent JPQL statement. Note that table is MovieDetails and entity is MovieEntity.