Test Question Software Answered
Test Question Software Answered
The ProductsPriceLog table stores the previous price in the OldPrice column and the new price in the NewPrice
column.
You need to increase the values in the Price column of all products in the Products table by 5 percent. You also
need to log the changes to the ProductsPriceLog table. Which Transact-SQL query should you use?
A. UPDATE Products SET Price = Price * 1.05 OUTPUT inserted.ProductCode, deleted.Price, inserted.Price * INTO
ProductsPriceLog(ProductCode, OldPrice, NewPrice)
B. UPDATE Products SET Price = Price * 1.05 INSERT INTO ProductsPriceLog (ProductCode, CldPnce, NewPrice;
SELECT ProductCode, Price, Price * 1.05 FROM Products
C. UPDATE Products SET Price = Price * 1.05 OUTPUT inserted.ProductCode, deleted.Price, inserted.Price INTO
ProductsPriceLog(ProductCode, OldPrice, NewPrice)
D. UPDATE Products SET Price = Price * 1.05 OUTPUT inserted.ProductCode, inserted.Price, deleted.Price INTO
ProductsPriceLog(ProductCode, OldPrice, NewPrice)
2: Your database contains a table named SalesOrders. The table includes a DATETIME column named OrderTime
that stores the date and time each order is placed. There is a non-clustered index on the OrderTime column.
The business team wants a report that displays the total number of orders placed on the current day. You need to
write a query that will return the correct results in the most efficient manner. Which Transact-SQL query should
you use?
1
3: You work as the Senior Database Administrator (DBA) at ABC.com. The company has a main office and 10 branch
offices. Each branch office contains a single database server running Microsoft SQL Server 2012.
The main office has multiple clustered servers running Microsoft SQL Server 2012. Your role includes the
management of the entire Microsoft SQL Server 2012 infrastructure. The company runs a custom application that
stores data in a large Microsoft SQL Server 2012 database.
The primary database is hosted in the main office. Each branch office SQL Server hosts a copy of the database. You
need to configure a solution that will replicate the entire primary database from the main office SQL Server every
weekend.
A. Transactional Replication
C. Log Shipping
D. Snapshot Replication
4: You work as a Database Administrator (DBA) at ABC.com. The infrastructure includes servers running Microsoft
SQL Server 2012. All databases are hosted on a SAN (Storage Area Network).
You need to design a database solution for a new application. You are tasked with designing a high-availability
database solution.
The solution must include a single copy of the database to save disk space and the database must remain online in
the event of a SQL Server failure. What should you include in your solution?
C. You should include two servers configure as a SQL Server Availability Group
5. You want to simulate read, write, checkpoint, backup, sort, and read-ahead activities for your organization’s SQL
Server 2012 deployment. Which of the following tools would you use to accomplish this goal?
A. SQLIO
B. chkdsk
C. SQLIOStress
D. SQLIOSim
2
6. You want to reproduce the same SQL Server 2012 installation configuration across five servers. Which of the
following files will you generate by using SQL Server Setup to accomplish this goal?
A. Setup.ini
B. Configuration.xml
C. ConfigurationFile.ini
D. Setup.xml
7. You want to remove SQL Server Integration Services from a server running the Windows Server 2008 R2
operating system that also has the Database Engine and SQL Server Analysis Services installed. Which of the
following tools can you use to accomplish this goal?
8. You use Microsoft SQL Server 2012 to write code for a transaction that contains several statements. There is
high contention between readers and writers on several tables used by your transaction.
You need to minimize the use of the tempdb space. You also need to prevent reading queries from blocking writing
queries. Which isolation level should you use?
B. REPEATABLE READ
C. SNAPSHOT
D. SERIALIZABLE
9. You use Microsoft SQL Server 2012 to develop a database application. You need to implement a computed
column that references a lookup table by using an INNER JOIN against another table. What should you do?
A. Add a default constraint to the computed column that implements hard-coded values.
B. Create a BEFORE trigger that maintains the state of the computed column.
D. Add a default constraint to the computed column that implements hard-coded CASE statements.
3
10. You use Microsoft SQL Server 2012 to develop a database application. You need to create an object that meets
the following requirements:
A. Scalar-valued function
C. Inline function
D. Stored procedure
11. Your database contains two tables named DomesticSalesOrders and InternationalSalesOrders. Both tables
contain more than 100 million rows. Each table has a Primary Key column named SalesOrderId. The data in the two
tables is distinct from one another.
Business users want a report that includes aggregate information about the total number of global sales and total
sales amounts. You need to ensure that your query executes in the minimum possible time. Which query should
you use?
4
12. Your database contains a table named Purchases. The table includes a DATETIME column named PurchaseTime
that stores the date and time each purchase is made.
There is a nonclustered index on the PurchaseTime column. The business team wants a report that displays the
total number of purchases made on the current day.
You need to write a query that will return the correct results in the most efficient manner. Which Transact-SQL
query should you use?
D. SELECT COUNT(*) FROM Purchases WHERE PurchaseTime >= CONVERT(DATE, GETDATE()) AND PurchaseTime <
DATEADD(DAY, 1, CONVERT(DATE, GETDATE()))
13. Your database contains a table named Customer that has columns named CustomerID
and Name.
You want to write a query that retrieves data from the Customer table sorted by Name
listing 20 rows at a time. You need to view rows 41 through 60.
Which Transact-SQL query should you create?
B. Select * from Customer order by Name OFFSET 40 ROWS FRETCH NEXT 20 ROWS Only
D. With Data as (Select *.RN – Row_Number() Over (Order by CustomerID,Name) from Customer) Select * from
Data where data.rn between 40 AnD 60
14. Your application contains a stored procedure for each country. Each stored procedure accepts an employee
identification number through the @EmpID parameter.
You need to build a single process for each employee that will execute the appropriate stored procedure based on
the country of residence.
B. Cursor
C. BULK INSERT
D. View
E. A user-defined function
5
15. You use Microsoft SQL Server 2012 to develop a database application. Your application sends data to an
NVARCHAR(MAX) variable named @var. You need to write a Transact-SQL statement that will find out the success
of a cast to a decimal (36,9). Which code segment should you use?
B. SELECT CASE WHEN convert (decimal(36,9), @var) IS NULL THEN 'True' ELSE 'False' END AS BadCast
C. TRY( SELECT convert (decimal(36,9), @var) SELECT 'True' As BadCast ) CATCH( SELECT 'False' As BadCast )
16. You use Microsoft SQL Server 2012 to develop a database application. You need to create an object that meets
the following requirements:
C. stored procedure
D. scalar-valued function
6
Sample Table – Worker
WORKER_ID FIRST_NAME LAST_NAME SALARY JOINING_DATE DEPARTMENT
7
17. Write an SQL query to fetch the count of employees working in the department ‘Admin’.
18. Write an SQL query to print details of the Workers whose FIRST_NAME ends with ‘a’.
19. Write an SQL query to fetch worker names with salaries >= 50000 and <= 100000.
20. Write an SQL query to fetch duplicate records having matching data in some fields of a table.
8
22. Write an SQL query to show the current date and time.
23. Write an SQL query to show the top n (say 10) records of a table.
24. Write an SQL query to fetch the list of employees with the same salary.
25. Write an SQL query to show all departments along with the number of people in there.
9
B. C# Test (30 mins)
1. Predict the output for the given set of code correctly.
A. My Name
B. My nAme
C. My name
D. Myname
2. Select the relevant code set to fill up the blank for the following program :
B. x % y == 0 ? y += 10:(x += 10);
10
3. Which is the String method used to compare two strings with each other ?
A. Compare To()
B. Compare()
C. Copy()
D. ConCat()
4. Which datatype should be more preferred for storing a simple number like 35 to improve execution speed of a
program?
A. sbyte
B. short
C. int
D. long
A. 1, 97
B. 65, 90
C. 65, 97
D. 97, 1
11
}
label: Console.WriteLine("HI...");
Console.ReadLine();
}
A. Hi…infinite times
C. Hi Hi
D. Hi…
A. Only 1 is correct
B. Only 2 is correct
A. 3245
B. 2354
C. 2345
D. 5423
12
9. Which of these keywords must be used to monitor exceptions?
A. try
B. finally
C. throw
D. catch
10. Can the method add() be overloaded in the following ways in C#?
A. True
B. False
B. Objects have methods and events that allow them to perform actions
C. All objects created from a class will occupy equal number of bytes in memory
12. “A mechanism that binds together code and data in manipulates, and keeps both safe from outside
interference and misuse.In short it isolates a particular code and data from all other codes and data. A well-defined
interface controls the access to that particular code and data.”
A. Abstraction
B. Polymorphism
C. Inheritance
D. Encapsulation
13
13. How many values does a function return?
A. 0
B. 2
C. 1
A. ‘==’ operator is used to assign values from one variable to another variable ‘=’ operator is used to compare
value between two variables
B. ‘=’ operator is used to assign values from one variable to another variable ‘==’ operator is used to compare
value between two variables
B. a.GetUpperBound(0) gives 9
A. HelloILoveComputerScience
D. Hello
14
17. Which of these data type values is returned by equals() method of String class?
A. char
B. int
C. boolean
C. Output is : >0 for (A > B), <0 for (A < B) else ‘0’ for(A=B)
19. What will be the declaration of the variable ptr as the pointer to array of 6 floats?
A. float *ptr[6].
B. float [6]*ptr
C. float(*ptr)[6].
D. float(*ptr)(6).
A. String()
B. String(void)
C. String(0)
15
C. Java (30 mins)
1 : Select the one correct answer. The number of characters in an object of a class String is given by
(A) The member variable called size
16
3 : What gets displayed on the screen when the following program is compiled and run. Select the one
correct answer.
x = 5 >> 2;
y = x >>> 2;
System.out.println(y);
}
}
(A) 5
(B) 2
(C) 80
(D) 0
17
4 : What all gets printed when the following gets compiled and run. Select the two correct answers.
public class test {
public static void main(String args[]) {
int i=1, j=1;
try {
i++;
j--;
if(i == j)
i++;
}
catch(ArithmeticException e) {
System.out.println(0);
}
catch(ArrayIndexOutOfBoundsException e) {
System.out.println(1);
}
catch(Exception e) {
System.out.println(2);
}
finally {
System.out.println(3);
}
System.out.println(4);
}
}
a. 0
b. 1
c. 2
d. 3
e. 4
(A) a,d,c
(B) b,c,a
(C) d,e
(D) a,b
18
5 : Which are true in case of interface?
(A) we can create object implementation to an interface
(B) ^
(C) |
(D) !
(B) xy+abc
(B) 4
(C) 6
(D) 2
19
10 : Select the one correct answer. The smallest number that can be represented using short primitive type
in Java is -
(A) -127
(B) -128
(C) 0
(D) -32768
11 : Which of these are core interfaces in the collection framework. Select the one correct answer.
(A) Tree
(B) Array
(C) LinkedList
(D) Map
12 : Which of the following are legal declaration and definition of a method. Select all correct answers.
a. void method() {};
b. void method(void) {};
c. method() {};
d. method(void) {};
e. void method {};
(A) a,b
(B) a
(C) a,b,c
(D) b,d,e
13 : What is the minimum value of char type. Select the one correct answer.
(A) 0
(B) -215
(C) -28
(D) -215 - 1
20
14 : To make a variable defined in a class accessible only to methods defined in the classes in same
package, which of the following keyword should be used. Select the one correct answer.
(A) By using the keyword public before the variable.
(D) The variable should not be preceded by any of the above mentioned keywords.
15 : What would happen when the following is compiled and executed. Select the one correct answer.
class example {
int x;
int y;
String name;
public static void main(String args[]) {
example pnt = new example();
System.out.println("pnt is " + pnt.name +
" " + pnt.x + " " + pnt.y);
}
}
(A) The program does not compile because x, y and name are not initialized.
(B) The program throws a runtime exception as x, y, and name are used before initialization.
(B) 2
(C) -1
(D) 4
21
17 : What is the legal range of values for a variable declared as a byte. Select the one correct answer.
(A) 0 to 255
(B) 0 to 256
(B) Byte
(C) Int
(D) Double
19 : Which of the following are true. Select the three correct answers.
a. A static method may be invoked before even a single instance of the class is constructed.
b. A static method cannot access non-static methods of the class.
c. Abstract modifier can appear before a class or a method but not before a variable.
d. final modifier can appear before a class or a variable but not before a method.
E. Synchronized modifier may appear before a method or a variable but not before a class.
(A) a,b,c
(B) a,b
(C) b,c,d
22
20 : By using which modifier we can prevent from overridden?
(A) final
(B) static
23
D. Personality Test (30 mins)
Instructions
In the table below, for each statement 1-50 mark how much you agree with on the scale 1-5, where
1=disagree, 2=slightly disagree, 3=neutral, 4=slightly agree and 5=agree, in the box to the left of it.
3. Am always prepared. 28. Often forget to put things back in their proper
place.
4. Get stressed out easily. 29. Get upset easily.
10. Have difficulty understanding abstract ideas. 35. Am quick to understand things.
11. Feel comfortable around people. 36. Don't like to draw attention to myself.
16. Keep in the background. 41. Don't mind being the center of attention.
24
20. Am not interested in abstract ideas. 45. Spend time reflecting on things.
22. Am not interested in other people's 47. Make people feel at ease.
problems.
23. Get chores done right away. 48. Am exacting in my work.
25