Você está na página 1de 13

What is the range of the short data type? 1. 0 to 216 2. -(215 ) to 215 - 1 3. -(216 ) to 216 - 1 4.

-(215 ) to 215 Correct Answer: -> 2 Your Answer: -> 2 Consider the following code snippet: m = 3; //1 n = 4; //2 m = ++n; //3 What will be the value of m and n after the //3 statement is executed? 1. m=3, n=4 2. m=3, n=5 3. m=5,n=5 4. m=4,n=5 Correct Answer: -> 3 Your Answer: -> 3

What will be the output of the following code snippet: import java.awt.*; import java.awt.event.*; import java.applet.*; /* <applet code="eventdemo.class" width=250 height=150> </applet> */ public class eventdemo extends Applet implements ActionListener { Label l1=new Label("Click the Button"); Button btn; public void init() { btn= new Button("Submit"); add("Center", btn); btn.addActionListener(this); } public void actionPerformed(ActionEvent ae) { Button src = (Button)ae.getSource(); src.setLabel("Submitted"); } } 1. On clicking the button, text of the button will be changed to Submitted from Submit. 2. On clicking the button, button will disappear. 3. On clicking the button, text of the button will not change. 4. On clicking the button, one more button will appear. Correct Answer: -> 1 Your Answer: -> 1

Which of the following options is not an advantage of Multithreading?

1. Improved performance 2. Simultaneous access to multiple applications 3. Lock Starvation 4. Program structure simplification Correct Answer: -> 3 Your Answer: -> 3

Which property of a DataView control specifies whether a member variable will be generated for the control or not? 1. Modifiers 2. GenerateMember 3. RowFilter 4. RowStateFilter Correct Answer: -> 2 Your Answer: -> 4

QualityProd Pvt. Ltd is an upcoming company that deals in the large scale produc tion of cosmetic products. To manage the details relating to various products, the company requires a software to manage the transactions re lating to the sale and purchase of these products. As a part of the development team, you have been assigned a task to write a cod e to create an application wherein you need to update the Prod_Price field of the Product_details table in such a manner so that the price of all the produ cts is increased by two. This needs to be done in such a way so that the updatio n process needs to be done in batches of four. Write a code that would enable you to accomplish this task. The details of the products need to be saved in the Pr oducts database. (Assume that the connection to the database has already been established with c onnection as the SqlConnection object.) 1. int price; SqlDataAdapter adapter = new SqlDataAdapter("Select * from Product_details", co nnection); SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(adapter); DataSet ds = new DataSet("Product_details"); adapter.Fill(ds, "Product_details"); foreach (DataRow dr in ds.Tables["Product_details"].Rows) { price = Convert.ToInt32(dr["Prod_Price"]); dr["Prod_Price"] = Convert.ToString(price+2); } adapter.Update(ds, "Product_details"); 2. int price; SqlDataAdapter adapter = new SqlDataAdapter("Select * from Product_details", co nnection); SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(adapter); DataSet ds = new DataSet("Product_details"); adapter.Fill(ds, "Product_details"); foreach (DataRow dr in ds.Tables["Product_details"].Rows) { price = Convert.ToInt32(dr["Prod_Price"]); dr["Prod_Price"] = Convert.ToString(price+2); } adapter.UpdateBatchSize = 4; adapter.Update(ds, "Product_details");

3. int price; SqlDataAdapter adapter = new SqlDataAdapter("Select * from Product_details", co nnection); SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(adapter); DataSet ds = new DataSet("Product_details"); adapter.Fill(ds, "Product_details"); foreach (DataRow dr in ds.Tables["Product_details"].Rows) { price = Convert.ToInt32(dr["Prod_Price"]); dr["Prod_Price"] = Convert.ToString(price+2); } adapter.Update = 4; adapter.Update(ds, "Product_details"); 4. int price; SqlDataAdapter adapter = new SqlDataAdapter("Select * from Product_details", co nnection); SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(adapter); DataSet ds = new DataSet("Product_details"); adapter.Fill(ds, "Product_details"); foreach (DataRow dr in ds.Tables["Product_details"].Rows) { price = Convert.ToInt32(dr["Prod_Price"]); dr["Prod_Price"] = Convert.ToString(price+2); } adapter.UpdateBatchSize(4); adapter.Update(ds, "Product_details"); Correct Answer: -> 2 Your Answer: -> 3

The following code has been written for replacing a photograph with a new one fr om the file: using (SqlCommand command = connection.CreateCommand()) { command.CommandText = "Select TEXTPTR(Photo) from Emp where EmpId='1004'"; photoPtr = (byte[])command.ExecuteScalar(); } using (SqlCommand command = connection.CreateCommand()) { command.CommandText = "UPDATETEXT Emp.Photo @A @null @C"; } Analyze the code and identify the errors in it. 1. The syntax of TEXRPTR is incorrect. It should be: TEXTPTR(Select (Photo) from Emp where EmpId='1004); 2. TEXTPTR should be declared after UPDATETEXT because TEXTPTR requires a point er which is returned by UPDATETEXT. 3. The syntax of UPDATETEXT is incorrect. It should be: UPDATETEXT Emp.Photo @A @B @null @C"; 4. The syntax of UPDATETEXT is incorrect. It should be: UPDATETEXT Emp.Photo @A @B null @C"; Correct Answer: -> 4 Your Answer: -> 4

Identify the design phase in which alternative designs of the proposed applicati on are created based on the requirements gathered. In this phase, the designers consider various aspects such as, behavior of the i nterface, interaction styles to be used, and the usability goals. 1. Requirements gathering 2. Conceptual design 3. Physical design 4. Evaluation Correct Answer: -> 2 Your Answer: -> 1

Consider the following statements: Statement A: The default value of float data type is 0.0. Statement B: The default value of short data type is 0. Which of the following options is correct with respect to the preceding stateme nts? 1. Statement A is true and statement B is false. 2. Statement A is false and statement B is true. 3. Both statements, A and B, are true. 4. Both statements, A and B, are false. Correct Answer: -> 3 Your Answer: -> 4

John works as an Application Developer with NTC Inc. He has to create a module t o identify the age group of a user. The requirement given to him states that if the age of the user is less than 20, the user belongs to the Teenager group and if the age of the user is between 21 and 100, he belongs to the Adult group. To achieve this, John writes the following code snippet and tests the application with age as 56: class IdentifyGroup { public static void main(String args[]) { int age = 56; if((age != 0) || (age < 20)) { System.out.println("Teenager"); } else if((age >= 21) || (age < 100)) { System.out.println("Adult"); } else { System.out.println("Invalid Age"); } } } What will be the output when he executes the preceding code snippet? Is the out

put correct? If not, identify the correct code that John should use. 1. The output will be: Adult. Yes, the output is correct. 2. The output will be: Teenager. No, the output is incorrect. He should use the following code to get the correct output: class IdentifyGroup { public static void main(String args[]) { int age = 56; if((age != 0) && (age < 20)) { System.out.println("Teenager"); } elseif((age >= 21) && (age < 100)) { System.out.println("Adult"); } else { System.out.println("Invalid Age"); } } } 3. The output will be: Teenager. No, the output is incorrect. He should use the following code to get the correct output: class IdentifyGroup { public static void main(String args[]) { int age = 56; if((age != 0) && (age < 20)) { System.out.println("Teenager"); } else if((age >= 21) && (age < 100)) { System.out.println("Adult"); } else { System.out.println("Invalid Age"); } } } 4. The output will be: Invalid Age. No, the output is incorrect. He should use the following code to get the correct output: class IdentifyGroup { public static void main(String args[]) { int age = 56; if((age =! 0) || (age < 20)) { System.out.println("Teenager"); } else if((age >= 21) || (age < 100)) {

System.out.println("Adult"); } else { System.out.println("Invalid Age"); } } } Correct Answer: -> 3 Your Answer: -> 4

Which of the following code snippets cannot be used for creating a new instance of the File class? 1. Directory dirObj=new Directory("C:/Files"); File f = new File(dirObj,"work.txt"); 2. File f = new File("C:/Files"); 3. File dirObj=new File("C:/Files"); File f = new File(dirObj,"work.txt"); 4. File f = new File("C:/Files","work.txt"); Correct Answer: -> 1 Your Answer: -> 2

Consider the following statements: Statement A: A thread enters the not runnable state when the loop in the run() method is complete. Statement B: You cannot restart a dead thread. Which of the following options is correct with respect to the preceding stateme nts? 1. Statement A is true and statement B is false. 2. Statement A is false and statement B is true. 3. Both statements, A and B, are true. 4. Both statements, A and B, are false. Correct Answer: -> 2 Your Answer: -> 3

John has developed an application in ADO.Net in which he needs to connect to the database only in the event of retrieval or updating of data in the database. Which feature of ADO.Net enables him to acc omplish this task? 1. Data cached in datasets 2. Disconnected data architecture 3. Scalability 4. Data transfer in XML format Correct Answer: -> 2 Your Answer: -> 1

QualityProds is an upcoming company that deals in the large scale production of electrical appliances.

The details of all these items needs to be saved in the Items table. As a part o f the development team, John is assigned a task to create an application in which the details of the new item is saved back in the database. To accomplish this task, he has written the following lines of code: (Assume that the connection has already been established with the database with cn as the connection object.) Line 1. SqlDataAdapter adapter = new SqlDataAdapter("Select * from Items", conn ection); Line 2. SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(adapter); Line 3. DataSet ds = new DataSet("Items"); Line 4. adapter.Fill(ds, "Items"); Line 5. DataRow row = ds.Tables["Items"].NewRow(); Line6. row["ProdId"] = textBox1.Text; Line 7. row["ProdName"] = textBox2.Text; Line 8. row["ProdPrice"] = textBox3.Text; Line 9. ds.Tables["Items"].Rows.Add(row); Identify whether the preceding code will give the desired output or not. 1. Line 5 is incorrect. The following code snippet is the correct syntax: DataRow row = adapter.Tables["Items"].NewRow(); 2. Line 9 is incorrect. The following code snippet is the correct syntax: ds.Tables["Items"].Add.Rows(row); 3. The code will execute but will not insert any value in the Items table. 4. The code will give the desired output. Correct Answer: -> 3 Your Answer: -> 4

How will you enable query notification for a database called Pubs? 1. ALTER DATABASE Pubs ENABLE_BROKER; 2. ALTER DATABASE Pubs SET ENABLE_BROKER; 3. ALTER DATABASE Pubs ENABLE SERVICE_BROKER; 4. ALTER DATABASE Pubs SET ENABLE SERVICEBROKER; Correct Answer: -> 2 Your Answer: -> 4

The website of Entera technologies, a hardware organization, provides informatio n about the new products to the user. This website also provides additional information about the products, such as it s features, configurations, and images. All this information is displayed on the same page, as a result, the page looks very cluttered. This causes the users to face difficulty in perceiving the information and therefore, gets confused. Identify the psycho logical response caused by this design. 1. Confusion 2. Annoyance 3. Panic 4. Boredom Correct Answer: -> 1 Your Answer: -> 2

Identify the output in the following code snippet: class X { X() { System.out.println("NIIT"); } } class Y extends X { Y() { System.out.println("Hello NIIT"); } } class display { public static void main(String args []) { Y = new Y(); } } 1. NIIT Hello NIIT 2. Hello NIIT NIIT 3. NIIT, Hello NIIT 4. Hello NIIT, NIIT Correct Answer: -> 1 Your Answer: -> 1

Interfaces contain a set of ________ methods and ________ data members. 1. abstract, static 2. static, abstract 3. void, abstract 4. abstract, private Correct Answer: -> 1 Your Answer: -> 4

You are writing a program in java where you want to place a mark at the current point in the input stream till the specified data bytes are read. Which of the following methods will you use to achieve this task? 1. int read(byte b[], int offset, int length) 2. long skip(long n) 3. reset() 4. mark(int nbyte) Correct Answer: -> 4 Your Answer: -> 1

What will be output of the following code snippet: class demo implements Runnable { Thread t2; demo(String str) { t2= new Thread(this, str ); t2.start(); } public void run() { System.out.println(" Now, the current thread is the child thread: " + t2); } } class is_alive { public static void main(String args[]) { Thread t1; t1=Thread.currentThread(); System.out.println("The current thread is the main thread: " + t1); demo d1=new demo("Child"); System.out.println("child thread is alive: " + d1.t2.isAlive()); try { System.out.println("Main thread waiting for child thread to finish"); d1.t2.join(); } catch(InterruptedException e) { System.out.println("Main thread is interrupted"); System.out.println("Main Thread is exiting"); } System.out.println("Child thread is alive: " + d1.t2.isAlive()); System.out.println("main thread is alive: " + t1.isAlive()); } } 1. The current thread is the main thread:Thread[main, 5, main] child thread is alive:false Now, the current thread is the child thread: ThreadChild, 5, main] Main thread waiting for child thread to finish child thread is alive:false main thread is alive:false 2. The current thread is the main thread:Thread[main, 5, main] child thread is alive:true Now, the current thread is the child thread: ThreadChild, 5, main] Main thread waiting for child thread to finish child thread is alive:true main thread is alive:true 3. The current thread is the main thread:Thread[main, 5, main] child thread is alive:true

Now, the current thread is the child thread: ThreadChild, 5, main] Main thread waiting for child thread to finish child thread is alive:true main thread is alive:false 4. The current thread is the main thread:Thread[main, 5, main] child thread is alive:true Now, the current thread is the child thread: ThreadChild, 5, main] Main thread waiting for child thread to finish child thread is alive:false main thread is alive:true Correct Answer: -> 4 Your Answer: -> 3

MyCallNet Ltd. is an upcoming call center company that stores the details of all its customers in the Customers table of the HR database. As a part of the development team, John is assigned a task to develop a windows based app lication in which he needs to delete the record of a particular customer on the basis of the Customer Id supplied in the textbox. To accomplish this task, he has written the following code: (Assume that the connection to the database is already open with con as the con nection object.) Line 1. string str = "delete from Customers where custId = '" + textBox1.Text + "'"; Line 2. SqlCommand cmd = new SqlCommand(str, con); Line 3. SqlDataReader dr = cmd.ExecuteReader(); Identify, whether the preceding code will give the desired output or not. 1. Line 3 is incorrect. The following code snippet is the correct syntax: SqlDataReader dr = cmd.ExecuteNonQuery(); 2. Line 2 is incorrect. The following code snippet is the correct syntax: SqlCommand cmd = new SqlCommand(con, str); 3. The code will execute but will not delete any record from the Customers tabl e. 4. The code will give the desired output. Correct Answer: -> 4 Your Answer: -> 4

Which of the following is not an SqlDbType enumeration value? 1. Binary 2. Varchar 3. LongInt 4. Char Correct Answer: -> 3 Your Answer: -> 3

Consider the following code snippet: XmlWriter writer = XmlWriter.Create("myXmlFile.xml",obj); In the preceding code snippet, what is obj? 1. object of XmlWriterSettings class 2. object of XmlReaderSettings class 3. object of XmlWriter class 4. object of XmlReader class Correct Answer: -> 1 Your Answer: -> 4

A website is being designed for a management college to provide the students wit h the information on the new session, the courses available, and the fee structure. For designing the website, the designers need to gather the information in terms of new courses, type of the course, total fees for the course, and so on. How will the designers star t with designing this website? 1. By collating 2. By collating 3. By collating 4. By collating Correct Answer: Your Answer: -> and analyzing and analyzing and analyzing and analyzing -> 3 1 functional requirements for the website non-functional requirements for the website data requirements for the website environmental requirements for the website

Sam is has written following java class: class Employee { /* code */ } Now, he wants to write a constructor for this class. Please help him to choose the correct constructor. 1. private void Employee() { } 2. public void Employee( int eid ) { } 3. public Employee() { } 4. public Emp() { } Correct Answer: -> 4 Your Answer: -> 3

Newways solutions is creating an online tutorial for kids. Susan, one of the de sign team members, is working on the colors strategy for the website. To make the website attractive, she used dark blue for the backgrou nd color and black for the text. However, while testing the website users faced a lot of readability issues. Analyze the above the scenario and identify which of the following color combinations Susan should have used to rectify the problem? 1. Red as the background and light blue as the text. 2. Light blue as the background and black for the text. 3. Dark brown as the background color and light green as the text. 4. Black as background color and white as foreground color. Correct Answer: -> 2 Your Answer: -> 4

Which option shows the allowed data type of a variable in the switch-case const ruct? 1. Float 2. Boolean 3. Byte 4. Double Correct Answer: -> 3 Your Answer: -> 4

Joe invoked wait() method on a newly created thread in a program. What will hap pen when he executes the program? 1. It will raise an iIllegalThreadStateException exception. 2. It will raise an IllegalAccessException exception. 3. It will raise an IllegalArguementException exception. 4. It will raised an NumberFormatExcetion exception. Correct Answer: -> 1 Your Answer: -> 3

Joe wants to access the record of a particular employee from the Employees table by specifying the employee id, which is the primary key. Which method of a Data Row object would enable him to accomplish this task? 1. Add() 2. Find() 3. Select() 4. Remove() Correct Answer: -> 2 Your Answer: -> 3

Which of the following code snippets will compile without error? 1. SqlDataReader myReader = command.ExecuteReader(CommandBehavior.SequentialAcc ess); while (myReader.Read()) { string fileName = @"C:\Patient.bmp"; fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write); bw = new BinaryWriter(fs); startIndex = 0; retval = myReader.GetBytes(); while (retval == bufferSize) { bw.Write(outbyte); bw.Flush(); startIndex += bufferSize; retval = myReader.GetBytes(); } bw.Write(outbyte, 0, (int)retval - 1); 2. SqlDataReader myReader = command.ExecuteReader(CommandBehavior.SequentialAcc ess); while (myReader.Read()) { string fileName = @"C:\Patient.bmp"; fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write); bw = new BinaryWriter(fs); startIndex = 0; retval = myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize);

while (retval == bufferSize) { bw.Write(outbyte); bw.Flush(); startIndex += bufferSize; retval = myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize); } bw.Write(outbyte, 0, (int)retval - 1); 3. SqlDataReader myReader = command.ExecuteReader(CommandBehavior.SequentialAcc ess); while (myReader.Read()) { string fileName = @"C:\Patient.bmp"; fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write); bw = new BinaryWriter(); startIndex = 0; retval = myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize); while (retval == bufferSize) { bw.Write(outbyte); bw.Flush(); startIndex += bufferSize; retval = myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize); } bw.Write(outbyte, 0, (int)retval - 1); 4. SqlDataReader myReader = command.ExecuteReader(CommandBehavior.SequentialAcc ess); while (myReader.Read()) { string fileName = @"C:\Patient.bmp"; fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write); bw = new BinaryWriter(); startIndex = 0; retval = myReader.GetBytes(); while (retval == bufferSize) { bw.Write(outbyte); bw.Flush(); startIndex += bufferSize; retval = myReader.GetBytes(); } bw.Write(outbyte, 0, (int)retval - 1); Correct Answer: -> 2 Your Answer: -> 3

Você também pode gostar