0
Alien head

programming languages Online Quiz - 240

Description: programming languages Online Quiz - 240
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

When you need to perform complex calculations or access external resources in SQL Server 2005, which one of the following programming methods do you use?

  1. SQL Server Management Studio

  2. CLR User Defined Type

  3. CLR Stored Procedure

  4. T-SQL View


Correct Option: C

You have created a cursor named test_cursor inside your stored procedure. Following is the cursor code: --------------------------------------------------------------------- DECLARE @Name AS VARCHAR(100) DECLARE test_cursor CURSOR FOR SELECT empname FROM Employee Order BY empid OPEN test_cursor FETCH NEXT FROM test_cursor INTO @Name WHILE @@FETCH_STATUS <> 0 BEGIN -- Do your internal procesing here FETCH NEXT FROM test_cursor INTO @Name END CLOSE test_cursor DEALLOCATE test_cursor --------------------------------------------------------------------- What correction is required in the code above?

  1. First Deallocate and then close

  2. Use @@FETCH_STATUS = 0 instead of @@FETCH_STATUS <> 0

  3. No need to use "FETCH NEXT FROM test_cursor INTO @Name" again before END statement

  4. Both i and ii


Correct Option: B

Which of the following is true about xp command shell in SQL Server 2005:

  1. xp command shell can be enabled by sysadmin by executing following: EXEC sp_configure 'xp_cmdshell', 0;

  2. xp command shell is enabled by default;

  3. xp command shell can be used to run bcp utility

  4. None of above


Correct Option: C

While creating a view from two tables, you need to ensure that view cannot be affected by modifications to underlying table schema. What should you do to accomplish this goal with least possible amount of overhead?

  1. Create CHECK constraints on the tables

  2. Create a DDL trigger to rollback any changes to the tables if then changes affect the columns in the view.

  3. Create the view, specifying the WITH SCHEMABINDING option.

  4. Create the view, specifying the WITH CHECK option.


Correct Option: C

Consider the table and query below: Table Name: products category type price indoor kitchen 1.50 outdoor garden 6.00 indoor Bathroom 4.75 outdoor garden 20.20 indoor bathroom 4.25 Office desktop 9.80 SELECT category, COUNT(DISTINCT type) FROM products GROUP BY category How many rows are returned by the SQL statement listed above?

  1. One row

  2. Two rows

  3. Three rows

  4. Four rows


Correct Option: C

Which is false about reading/writing XML data using System.Xml:

  1. XPathDocument class is very fast, but it is read-only

  2. The XmlDocument class provides editable representation of XML document, but is comparatively slower.

  3. XPathNavigator object can be created using both XPathDocument and XmlDocument classes, which can be used to to select and navigate XML data.

  4. None of the above


Correct Option: D

Which of the following is false for Managed Code performance improvement:

  1. Late binding defers type identification process until run time, so prefer Late Binding whenever possible

  2. Always enable Option Explicit and Option Strict options(while using Visual Basic.NET)

  3. If Com objects is referred in code, destroy COM objects always after use

  4. While implementing threading, do not use Thread.Abort to terminate other threads


Correct Option: A

Suppose you are implementing paging to your datagrid named grdtest using following code: protected void grdtest_PageChanger(object Source, DataGridPageChangedEventArgs E) { DataTable dttable = new DataTable(); //populate dttable with appropriate data from database grdtest.DataSource = dttable; grdtest.DataBind(); } what is the main thing missing in above code:

  1. grdtest.AllowCustomPaging = true;

  2. grdtest.AllowPaging = true;

  3. grdtest.CurrentPageIndex = E.NewPageIndex;

  4. Both i and ii


Correct Option: C

You have following two code segments to read records from flat-file/excel: Code segment 1: OleDbConnection con; con = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + System.IO.Path.GetDirectoryName(filename) + "; Extended Properties = \"Text;HDR=YES;FMT=Delimited\""); Code segment 2: OleDbConnection con; con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";Extended Properties=Excel 8.0;"); Which one of following is true:

  1. both can create connection to excel and flat files

  2. only second can create connection to excel

  3. first one can create connection to both excel and flat files, whereas second one can craete connection only to Excel

  4. None of the above


Correct Option: B

Which of the following is not true about Microsoft Silverlight:

  1. Both cross browser and cross platform compatible

  2. XAML can be used for programming user interface

  3. Can be considered as replacement for Windows Presentation Foundation

  4. All of the above


Correct Option: C

Which of the following is the correct syntax for using Dictionary object in your code:

  1. using System.Collections.Generic; Dictionary < string , StringBuilder >() dctobj = new Dictionary < string , StringBuilder >;

  2. using System.Collections.Generic; Dictionary < string , StringBuilder > dctobj = new Dictionary < string , StringBuilder >();

  3. using System.Collections.Generic; Dictionary < string , StringBuilder > dctobj = new Dictionary < string , StringBuilder >;

  4. using System.Text; Dictionary < string , StringBuilder > dctobj = new Dictionary < string , StringBuilder >();


Correct Option: B

Consider the following query: SELECT firstname, lastname, SUM(salary) FROM employees GROUP BY firstname, lastname HAVING SUM(salary) > 20000 ORDER BY lastname ASC Which part of the sample code above contains the SQL default and is therefore NOT necessary in the SQL statement?

  1. SUM

  2. >

  3. Group by

  4. ASC


Correct Option: D

Consider the table and query below: row_id seat_1 seat_2 seat_3 1 boy boy boy 2 girl girl girl 3 boy girl boy 4 girl boy girl 5 boy boy girl 6 girl boy boy SELECT * FROM seating WHERE seat_2 = 'boy' ORDER BY seat_3 DESC, seat_1 Which row is first in the results set returned by the SQL statement above?

  1. 2

  2. 4

  3. 5

  4. 6


Correct Option: C

What is true for DELETE & TRUNCATE commands?

  1. Truncate command is same as delete command with no where clause.

  2. Data cannot be rolled back when Truncate command is used, while data can be rolled back when delete command used.

  3. Data cannot be rolled back when Delete command is used, while data can be rolled back when truncate command used.

  4. Both are DML commands.


Correct Option: B

Which out the following displays a client-side alert message “Processing Successful”, but the code is written at server-side based on some processing:

  1. string strMessage = "Processing Successful"; string strScript = "alert('" + strMessage + "');"; if(!ClientScript.IsClientScriptBlockRegistered("Startup")) {ClientScript.RegisterClientScriptBlock(Page.GetTy

  2. string strMessage = "Processing Successful"; string strScript = " alert('" + strMessage + "');"; if(!ClientScript.IsClientScriptBlockRegistered("Startup")) {ClientScript.RegisterClientScriptBlock(Page.GetType(), "startup", strScript);}

  3. string strMessage = "Processing Successful"; string strScript = "alert('" + strMessage + "');"; ClientScript. RegisterStartupScript(Page.GetType(), "startup", strScript);

  4. string strMessage = "Processing Successful"; string strScript = " alert('" + strMessage + "');"; ClientScript. RegisterStartupScript(Page.GetType(), "startup", strScript);


Correct Option: A

Which statement is true for primary key and a unique key?

  1. Both are same.

  2. A table can have multiple primary key and unique key.

  3. Primary keys does not allow null values, but unique key allows only one null value.

  4. Both does not allow null values


Correct Option: C

Which one of following is false about Microsoft-provided data provider classes in ADO.NET ?

  1. SQLServer.NET data provider is faster than any other provider.

  2. OLE-DB.NET is universal for accessing various data sources other than SQL Server also, but it’s a .NET layer on top of OLE layer, so is comparatively slow.

  3. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.

  4. None of the above


Correct Option: D

Connection string entries in web.config file can be encrypted using following tool(S): 1. aspnet_regiis.exe 2. aspnet_wp.exe 3. svcutil.exe

  1. Both 1 and 2

  2. Only 1

  3. Only 2

  4. Both 1 and 3


Correct Option: B

Which of the below is false about Struct.

  1. Structs are value-type variables

  2. Structs are saved on stack

  3. structs can be inherited.

  4. None of the above.


Correct Option: D

What does Debug.assert() do?

  1. takes Boolean condition as parameter and shows error dialog if condition is true; but proceeds without interruption if condition is false.

  2. takes Boolean condition as parameter and throws exception if condition is false; but proceeds without interruption if condition is true.

  3. takes Boolean condition as parameter and shows error dialog if condition is false; but proceeds without interruption if condition is true.

  4. None of above


Correct Option: C
+ View questions