0

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

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

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

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
  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

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

AI Explanation

To answer this question, we need to understand the concepts of primary key and unique key in a database.

A primary key is a column or a set of columns that uniquely identifies each row in a table. It is used to enforce entity integrity and ensure that each row in the table is unique.

A unique key, on the other hand, is a constraint that ensures that the values in a column or a set of columns are unique. Unlike a primary key, a unique key can allow null values.

Let's go through each option to understand why it is correct or incorrect:

Option A) Both are the same - This option is incorrect because primary key and unique key are not the same. While they both enforce uniqueness, there are differences in their behavior.

Option B) A table can have multiple primary keys and unique keys - This option is incorrect. A table can have only one primary key, which uniquely identifies each row. However, it can have multiple unique keys, which enforce uniqueness on different columns or combinations of columns.

Option C) Primary keys do not allow null values, but unique keys allow only one null value - This option is correct. Primary keys do not allow null values because they are used to uniquely identify each row. Unique keys, on the other hand, can allow one null value. This means that while unique keys enforce uniqueness, they allow one row to have a null value in the column(s) covered by the unique key.

Option D) Both do not allow null values - This option is incorrect. As mentioned earlier, primary keys do not allow null values, but unique keys can allow one null value.

Based on the explanations above, the correct answer is Option C. Primary keys do not allow null values, but unique keys allow only one null value.

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

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
  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

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

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 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

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

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
  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

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

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
- Hide questions