Category Archives: Upwork .Net Technology

Upwork .Net Technology

Knowledge of SQL Server 2008 Skills Test 2016

Published by:

1. Which of the following statements using GROUP BY clause are allowed in SQL Server 2008?

Answers:

  1. SELECT Column1 + Column2 FROM Table GROUP BY Column1, Column2
  2. SELECT Column1, Column2 FROM Table GROUP BY Column1 + Column2
  3. SELECT Column1 + constant + Column2 FROM Table GROUP BY Column1 + Column2
  4. SELECT Column1 + Column2 FROM Table GROUP BY Column1 + Column2

2. What is the function of DBCC CHECKDB command in SQL Server 2008?

Answers:

  1. It checks the allocation of all the objects in the specified database.
  2. It checks the structural integrity of all the objects in the specified database.
  3. It checks for consistency in and between system tables in the specified database.
  4. It checks the consistency of disk space allocation structures of a specified database.

3. Which of the following compression features have been introduced in SQL Server 2008 that were NOT supported by SQL Server 2005?

Answers:

  1. Row-level compression
  2. Page-level compression
  3. Data file level compression
  4. Backup level compression

4. Which of the following rules must be followed for combining the result sets of two queries by using UNION?

Answers:

  1. The number of columns must be same in all queries.
  2. The order of columns must be same in all queries.
  3. The data types of the columns of the queries must be compatible.
  4. There should be at least one common column in the tables which are part of the UNION operation.

5. Which of the following scripting options are available while creating a script using the shortcut menu from the Object Explorer in SQL Server 2008 Management Studio?

Answers:

  1. DELETE To
  2. MERGE To
  3. CREATE INDEX To
  4. INSERT To
  5. UPDATE To

6. Which of the following options are available for the DATA_COMPRESSION clause specified for a table in SQL Server 2008?

Answers:

  1. Page
  2. Table
  3. Row
  4. Column

7. Which of the following methods can be specified for the lock escalation of a table in SQL Server 2008?

Answers:

  1. ENABLE
  2. AUTO
  3. DISABLE
  4. TABLE
  5. DEFAULT

8. Which of the following data types are supported by SQL Server 2008?

Answers:

  1. date
  2. datetime
  3. datetime1
  4. datetime2
  5. datetimeoffset

9. Which of the following statements are true?

Answers:

  1. IGNORE_DUP_KEY cannot be set to ON for XML indexes.
  2. IGNORE_DUP_KEY can be set to ON for spatial indexes.
  3. IGNORE_DUP_KEY can be set to ON for filtered indexes.
  4. IGNORE_DUP_KEY can be set to ON for XML indexes.
  5. IGNORE_DUP_KEY cannot be set to ON for indexes created on a view.

10. Which of the following statements are true regarding row and page compression in SQL Server 2008?

Answers:

  1. When a table or index is created, data compression is set to NONE, unless otherwise specified.
  2. Nonclustered indexes inherit the compression property of the table.
  3. New pages allocated in a heap as part of DML operations will not use PAGE compression until the heap is rebuilt.
  4. When you are compressing indexes, leaf-level pages can be compressed with only page compression.

11. Which of the following security features have been introduced in SQL Server 2008?

Answers:

  1. Extensible Key Management
  2. SOAP Security
  3. Hashing
  4. Transparent Data Encryption

12. Which of the following encryption algorithms are used by the Transparent Data Encryption security mechanism of SQL Server 2008?

Answers:

  1. Tiny Encryption Algorithm
  2. Advanced Encryption Standard(AES)
  3. Blowfish
  4. Triple Data Encryption Standard(3DES)

13. Which of the following formats are supported by the language_term argument while altering a full-text stoplist in SQL Server 2008?

Answers:

  1. Integer
  2. Binary
  3. Decimal
  4. Hexadecimal

14. Which of the following are valid DATETIME functions in SQL Server 2008?

Answers:

  1. SYSDATE()
  2. SYSTIME()
  3. SYSDATETIME()
  4. SYSUTCDATETIME()

15. Which of the following counters are used to monitor compression of the whole instance of SQL Server?

Answers:

  1. Page compression attempts/sec
  2. Row compression/sec
  3. Pages compressed/min
  4. Pages compressed/sec
  5. Rows compressed/min

16. Which of the following statements are true about the FILESTREAM argument of SQL Server 2008?

Answers:

  1. If a table contains FILESTREAM data and the table is partitioned, the FILESTREAM_ON clause must be included.
  2. The FILESTREAM column can be partitioned even if a table is not partitioned.
  3. There may not be a FILESTREAM filegroup if a table is not partitioned and the FILESTREAM_ON clause is not specified.
  4. The filegroup in the FILESTREAM_ON <filegroup>> clause must have one file defined for the filegroup.

17. Which of the following spatial data types are used in SQL Server 2008?

Answers:

  1. Geography
  2. Longitude
  3. Altitude
  4. Geometry
  5. Latitude

18. Which function/functions are performed by the following statement?
BCC CHECKIDENT (‘table_name’, RESEED, new_reseed_value)

Answers:

  1. It checks the current iDentity fielD value of the specifieD table.
  2. It sets the identity field value to the new reseed value.
  3. It sets the identity field value to 1.
  4. All of the above.

19. Which of the following statements are true about FILESTREAM storage in SQL Server 2008?

Answers:

  1. Transact-SQL can be used to SELECT, INSERT, UPDATE, DELETE FILESTREAM data.
  2. The size of the stored data is limited to 2 GB.
  3. You cannot take backup of a database without the FILESTREAM data.
  4. FILESTREAM storage is best used when the BLOB file sizes average 1MB or higher.

20. Which of the following permissions are required to create a view in SQL Server 2008?

Answers:

  1. CREATE VIEW permission in database
  2. ALTER permission on schema
  3. CONTROL permission on object

21. For which of the following data types can a COLLATE clause be applied?

Answers:

  1. text
  2. int
  3. varchar
  4. bigint

22. Columns marked with which of the following constraints/properties allow null values to be inserted in them?

Answers:

  1. PRIMARY KEY
  2. UNIQUE
  3. IDENTITY
  4. FOREIGN KEY

23. Analyze the following code used to update a Common Table Expression:

USE demodb
GO
DECLARE @a TABLE (ID int, Value int);
DECLARE @b TABLE (ID int, Value int);
INSERT @a VALUES (1, 10), (2, 20);
INSERT @b VALUES (1, 100),(2, 200);
WITH cte AS (SELECT * FROM @a)
UPDATE cte
SET Value = b.Value
FROM cte AS a
INNER JOIN @b AS b ON b.ID = a.ID
SELECT * FROM @a
GO

What Will be the output of the above code?

Answers:

  1. ID Value —– —– 1 100 2 200
  2. ID Value —– —– 1 10 2 100
  3. ID Value —– —– 1 10 2 200
  4. ID Value —– —– 1 100 2 100

24. The Server Audit object and the Server Audit Specification object of SQL Server 2008 share a __________ relationship.

Answers:

  1. One-to-one
  2. One-to-many
  3. Many-to-one
  4. Many-to-many

25. What is the maximum value for the sum of the values of MIN_CPU_PERCENT and MIN_MEMORY_PERCENT for all the resource pools of SQL Server?

Answers:

  1. 50
  2. 75
  3. 100
  4. 150
  5. 200

26. An identifier denoting a global temporary object in SQL Server 2008 starts with a ______ sign.

Answers:

  1. At sign(@)
  2. Double number(##)
  3. Underscore(_)
  4. None of the above

27. Which of the following features is used by SQL Server Audit to create and manage audits in SQL Server 2008?

Answers:

  1. System stored procedures
  2. Triggers
  3. SQL DDL syntax
  4. None of the above

28. What is returned by NULLIF if the two expressions that it compares are NOT equal?

Answers:

  1. It returns the first expression.
  2. It returns the second expression.
  3. It returns a null value.
  4. It returns an error.

29. User defined data type columns can be designated with ROWGUIDCOL.

Answers:

  1. True
  2. False

30. Which of the following commands is used to save the output to a text file after you run a Transact-SQL script using sqlcmd?

Answers:

  1. sqlcmd -S instanceName -o C:new.txt
  2. sqlcmd -S instanceName -i C:myScript.sql -o C:new.txt
  3. sqlcmd -S myServerinstanceName -o C:new.txt
  4. sqlcmd -S myServerinstanceName -i C:myScript.sql -o C:new.txt

31. Analyze the following code snippet:

DECLARE @myTime TIME(4) = ’02:02:02.234567 +01:01′
SELECT @myTime AS ‘@myTime’

What is the output of the above code?

Answers:

  1. 02:02:02.2345
  2. 02:02:02
  3. 02:02:02.2346
  4. An error is displayed

32. Which of the following is used by SQL Server 2008 Management Studio to execute scripts in regular mode in the Query Editor?

Answers:

  1. sqlcmd
  2. Microsoft .NET Framework SqlClient
  3. OLE DB provider
  4. None of the above

33. What is the default value of the SORT_IN_TEMPDB clause of the relational_index_option specified at the time of creation of an index on a table in SQL Server 2008?

Answers:

  1. ON
  2. OFF
  3. TRUE
  4. FALSE

34. Which of the following statements is NOT true about the UNIQUE constraint of SQL Server 2008?

Answers:

  1. Multiple UNIQUE constraints can be defined on a table.
  2. When using the UNIQUE constraint, only one null value is allowed per column.
  3. UNIQUE constraint cannot be referenced by a FOREIGN KEY constraint

35. Which of the following options is used to change the value of the password variable and exit using sqlcmd?

Answers:

  1. -p
  2. -P
  3. -z
  4. -Z

36. The regular identifiers of SQL Server 2008 may contain a range of _____________ characters.

Answers:

  1. 1 to 116
  2. 1 to 127
  3. 1 to 128
  4. 1 to 512

37. Which of the following evaluation modes of Policy-Based Management CANNOT be automated in SQL Server 2008?

Answers:

  1. On demand
  2. On change: prevent
  3. On change: log only
  4. On schedule

38. Which of the following statements is true if you create a global temporary table in SQL Server 2008 and specify a FOREIGN KEY with the CREATE TABLE command?

Answers:

  1. The table is created successfully with the FOREIGN KEY constraint.
  2. The table is not created and no message is returned.
  3. The table is created without the FOREIGN KEY constraint and a warning message is returned.
  4. The table is not created and an error message is displayed.

39. Which of the following features of SQL Server 2008 evaluates servers for compliance with a set of predefined conditions and prevents making undesirable changes to servers?

Answers:

  1. Data Compression
  2. Resource Governor
  3. Policy-Based Management
  4. Auditing

40. How many groupings are generated when CUBE is used with the GROUP BY clause of SQL Server 2008?

Answers:

  1. n (n= number of expressions in the element list passed to CUBE)
  2. n+1 (n= number of expressions in the element list passed to CUBE)
  3. 2^n (n= number of expressions in the element list passed to CUBE)
  4. 2^n+1 (n= number of expressions in the element list passed to CUBE)

41. Which of the following Audit objects primarily describes the destination where the audit data of SQL Server 2008 gets stored?

Answers:

  1. Server Audit object
  2. Server Audit Specification object
  3. Database Audit Specification object

42. Windows Security log can be specified as a target for Audit in SQL Server 2008.

Answers:

  1. True
  2. False

43. Which of the following is a valid code to delete a clustered index with a PRIMARY KEY constraint in SQL Server 2008?

Answers:

  1. ALTER TABLE Production.ProductCost DROP CONSTRAINT PK_Product WITH (ONLINE = ON) GO
  2. ALTER TABLE Production.ProductCostHistory DROP CONSTRAINT PK_Product DROP INDEX Index_Product WITH (ONLINE = ON) GO
  3. DROP INDEX Index_Product ON Production.ProductCost GO

44. What is the default timeout for login to sqlcmd while you try to connect to a server?

Answers:

  1. 5 seconds
  2. 8 seconds
  3. 10 seconds
  4. 15 seconds
  5. 1 minute

45. What is the default precision of the date data type in SQL Server 2008?

Answers:

  1. 4 digits
  2. 6 digits
  3. 8 digits
  4. 10 digits

46. What amount of storage is required by a date variable in SQL Server 2008?

Answers:

  1. 3 bytes
  2. 5 bytes
  3. 6 bytes
  4. 8 bytes

47. PRIMARY KEY constraint defaults to __________ index.

Answers:

  1. Clustered
  2. Nonclustered
  3. None of the above

48. Which of the following is a valid code to change the index created on a column of a table to page compression?

Answers:

  1. ALTER INDEX Index_Product ON Table1 WITH ( DATA_COMPRESSION = PAGE ) GO
  2. ALTER INDEX Index_Product ON Table1 SET ( DATA_COMPRESSION = PAGE ) GO
  3. ALTER INDEX Index_Product ON Table1 REBUILD WITH ( DATA_COMPRESSION = PAGE ) GO
  4. ALTER INDEX Index_Product ON Table1 REBUILD SET ( DATA_COMPRESSION = PAGE ) GO

49. What is the return type of the value returned by @@DATEFIRST in SQL Server 2008?

Answers:

  1. datetime
  2. date
  3. int
  4. tinyint

50. Which of the following features of SQL Server 2008 enables you to limit the memory used by incoming application requests?

Answers:

  1. Hot Add CPU
  2. Dynamic management views
  3. Resource Governor
  4. Backup Compression

51. Which data type of SQL Server 2008 converts itself into the type of data that is inserted into it?

Answers:

  1. real
  2. rowversion
  3. type_var
  4. sql_variant
  5. monetary

52. Analyze the following command:

-o “C:Folder<file_name>”

Which of the following statements is true if a file with the file name specified in the above command already exists?

Answers:

  1. An error is generated.
  2. The file is overwritten.
  3. None of the above.

53. Multiple CHECK constraints can be applied to a single column and a single CHECK constraint can be applied to multiple columns in SQL Server 2008.

Answers:

  1. True
  2. False

54. A local temporary stored procedure name can contain a maximum of __________ characters.

Answers:

  1. 58
  2. 116
  3. 128
  4. 512

55. Analyze the following code using wild card characters of SQL Server 2008:

SELECT Name
FROM person.employees
WHERE Name LIKE ‘[_]n’
GO

Which of the following values will be returned by the above code?

Answers:

  1. in
  2. sin
  3. _n
  4. All of the above

56. Which of the following is the default authentication mode for sqlcmd in SQL Server 2008?

Answers:

  1. Windows Authentication
  2. SQL Server Authentication
  3. IIS Authentication
  4. Digest Authentication

57. All MDX, DMX and XML/A errors are displayed in the Error List window of the SQL Server 2008. Management Studio.

Answers:

  1. True
  2. False

58. Which of the following stored procedures is used to delete data from the management data warehouse of a Data Collector?

Answers:

  1. core.sp_delete_data
  2. core.sp_purge_data
  3. core.sp_remove_data
  4. None of the above

59. What is the maximum number of processors that can be used in parallel plan execution using the MAXDOP option in SQL Server 2008?

Answers:

  1. 32 processors
  2. 50 processors
  3. 64 processors
  4. 75 processors

60. Which of the following arguments of the fn_get_audit_file() function of SQL Server 2008 specifies the directory indicating the location and audit file set to be read?

Answers:

  1. Initial_file_name
  2. File_pattern
  3. Audit_file_offset
  4. None of the above

61. Analyze the following code snippet:

DECLARE @myDate DATETIME2
SELECT @myDate = ‘2009/10/08 12:35:29.2348 +12:15’
SELECT @myDate AS ‘@myDate’

What is the output of the above code?

Answers:

  1. 2009-10-08 12:35:29
  2. 2009/10/08 12:35:29.2348000
  3. 2009-10-08 12:35:29.2348000
  4. 2009/10/08 12:35:29

62. What exactly is Full-Text Catalog in SQL Server 2008?

Answers:

  1. The Full-Text Catalog is an index for searching specific keywords.
  2. The Full-Text Catalog is a file which contains full-text indexes.
  3. The Full-Text Catalog is an inbuilt function for validating text data.
  4. The Full-Text Catalog is a system trigger for checking text validation.

63. Which of the following clauses of SQL Server 2008 avoids enforcing a constraint when repeated inserts are performed?

Answers:

  1. IDENTITY
  2. SPARSE
  3. NOT FOR REPLICATION
  4. COLLATE

64. Which of the following roles is required to connect to a Central Management Server?

Answers:

  1. ServerGroupReaderRole
  2. ServerGroupAdministratorRole
  3. PolicyAdministratorRole
  4. db_ssisoperator

65. What range is supported by the TIME data type in SQL Server 2008?

Answers:

  1. 00:00:00.0000000 through 23:59:59.9999999
  2. 00:00:00.0000000 through 24:00:00.0000000
  3. 00:00:00.0000000 through 23:59:00.0000000
  4. 00:00:00.0000000 through 23:59:59.0000000

66. Which of the following is a valid syntax of the ALTER SERVER AUDIT statement used to enable a server audit?

Answers:

  1. ALTER SERVER AUDIT <audit_name> WITH (ENABLE=TRUE)
  2. ALTER SERVER AUDIT <audit_name> SET (ENABLE=TRUE)
  3. ALTER SERVER AUDIT <audit_name> WITH (STATE=ON)
  4. ALTER SERVER AUDIT <audit_name> SET (STATE=ON)

67. What is the name of the default instance installed by SQL Server 2008 Express in your computer?

Answers:

  1. sqlinst
  2. sqlcmd
  3. sqlexpress
  4. sqldef

68. Analyze the following permissions:

1.ALTER permission on the database.
2.CONTROL permission in the database.
3.ALTER ANY SCHEMA permission and CREATE XML SCHEMA COLLECTION permission in the database.

Which of the above permissions is/are required to create an XML SCHEMA COLLECTION?

Answers:

  1. 1 and 2
  2. 2 and 3
  3. 1 and 3
  4. 1 or 2 or 3
  5. 1 and 2 and 3

69. Which of the following statements is true regarding indexes in SQL Server 2008?

Answers:

  1. Modifications made in a table will be faster if the number of indexes is more.
  2. Modifications made in a table will be slower if the number of indexes is more.
  3. The number of indexes does not affect the modification process of a table.

70. How many audit action groups are available for a server in SQL Server 2008 to perform different actions on audit data?

Answers:

  1. 25
  2. 30
  3. 35
  4. 40

71. Which of the following data types can be specified as SPARSE?

Answers:

  1. image
  2. text
  3. nchar
  4. geography

72. Analyze the following code snippet for creating a stored procedure in SQL Server 2008:
CREATE PROCEDURE Person.GetEmployees
@LastName nvarchar(50),
@FirstName nvarchar(50)
AS
SET NOCOUNT ON
SELECT FirstName, LastName, JobTitle, Department
FROM Person.EmployeeDepartment
WHERE FirstName = @FirstName AND LastName = @LastName
GO

Which of the following is a valid code to execute the GetEmployees stored procedure?

Answers:

  1. EXECUTE Person.GetEmployees N’John’, N’Miller’
  2. EXEC Person.GetEmployees @LastName = N’Miller’, @FirstName = N’John’
  3. EXECUTE Person.GetEmployees @FirstName = N’John’, @LastName = N’Miller’
  4. All of the above

73. Starting from the lowest, arrange the following operators in the order in which they produce results in an SQL WHERE query.

1. >, >=, <, <=
2. <>
3. =
4. LIKE

Answers:

  1. 1,4,3,2
  2. 4,1,2,3
  3. 3,2,1,4
  4. 2,4,1,3

74. What is the default maximum precision of decimal data type in SQL Server 2008?

Answers:

  1. 16
  2. 18
  3. 38
  4. 48

75. What is the maximum number of columns that can be combined into a single composite index key?

Answers:

  1. 8
  2. 16
  3. 32
  4. 64

76. Which of the following values specifies that each instance of the XML data type in column_name can contain multiple top-level elements?

Answers:

  1. DEFAULT
  2. CONTENT
  3. DOCUMENT
  4. FILESTREAM

77. Which of the following is the correct order of steps to be followed while using the Transparent Data Encryption security feature of SQL Server 2008?

Answers:

  1. 1. Create a database encryption key. 2. Create or obtain a certificate protected by the encryption key. 3. Create a master key and protect it by the certificate. 4. Set the database to use encryption.
  2. 1. Create a database encryption key. 2. Create a master key. 3. Create or obtain a certificate protected by the master key. 4. Set the database to use encryption.
  3. 1. Create a master key. 2. Create or obtain a certificate protected by the master key. 3. Create a database encryption key and protect it by the certificate. 4. Set the database to use encryption.

78. Which of the following commands is used to start the Resource Governor in SQL Server 2008?

Answers:

  1. ALTER Resource Governor Enable
  2. ALTER Resource Governor Reconfigure
  3. ALTER Resource Governor Set
  4. None of the above

79. Which of the following commands is used to connect to a named instance of SQL Server using the sqlcmd utility of SQL Server?

Answers:

  1. sqlcmd -C myServerinstanceName
  2. sqlcmd -S instanceName
  3. sqlcmd -C instanceName
  4. sqlcmd -S myServerinstanceName

80. Which of the following commands is used to run a Transact-SQL script file by using sqlcmd?

Answers:

  1. sqlcmd -S myServerinstanceName -i C:newScript.sql
  2. sqlcmd -S instanceName -o C:newScript.sql
  3. sqlcmd -S myServerinstanceName -r C:newScript.sql
  4. sqlcmd -S instanceName -i C:newScript.sql

81. What is the default precision of the TIME data type in SQL Server 2008?

Answers:

  1. 5 digits
  2. 6 digits
  3. 7 digits
  4. 10 digits

82. Which of the following permissions is required to drop a stored procedure in SQL Server 2008?

Answers:

  1. SELECT permission on the schema
  2. ALTER permission on the schema
  3. CONTROL permission on the procedure
  4. Both a and b
  5. Either b or c
  6. Both b and c

83. The login timeout when you try to connect to a server must be a number between __________.

Answers:

  1. 0 and 66020
  2. 1 and 65530
  3. 0 and 65534
  4. 1 and 65535

84. In which of the following statements can TOP clause be used in SQL Server 2008?

Answers:

  1. Only SELECT
  2. Only SELECT and INSERT
  3. Only SELECT, INSERT, UPDATE, DELETE
  4. Only SELECT, INSERT, UPDATE, MERGE, DELETE

85. Which of the following default passwords is used by sqlcmd if -P option is used at the end of the command prompt without a password?

Answers:

  1. 0000
  2. NULL
  3. 1234
  4. None of the above

86. Which of the following namespaces is used to manage the audit configuration programmatically in SQL Server 2008?

Answers:

  1. Microsoft.SqlServer.Management.Smo
  2. Microsoft.SqlServer.Server
  3. Microsoft.sqlserver.management.common
  4. Microsoft.sqlserver.connectioninfo

87. What happens to the audit records if a failure to write the Audit event does NOT trigger the SQL Server instance to shut down?

Answers:

  1. The server blocks any new activity to be performed to the SQL Server instance.
  2. Audit events are buffered in memory until they can be flushed to the target.
  3. The audit is automatically disabled.
  4. An error is displayed.

88. Which of the following code snippets causes only partition number 1 to be rebuilt while changing the compression of a partitioned table?

Answers:

  1. ALTER TABLE Table1 REBUILD WITH (DATA_COMPRESSION = PAGE)
  2. ALTER TABLE Table1 REBUILD PARTITION = 1 WITH (DATA_COMPRESSION = NONE) GO
  3. ALTER TABLE Table1 REBUILD PARTITION ALL WITH (DATA_COMPRESSION = PAGE ON PARTITIONS(1) )
  4. All of the above

89. Analyze the following data types and schemas:

1.The SQL Server system data type.
2.The default schema of the current user in the current database.
3.The dbo schema in the current database.

In which order does the SQL Server Database Engine refer to type_name when a type_schema_name is NOT specified while creating a table in SQL Server 2008?

Answers:

  1. 3,2,1
  2. 2,3,1
  3. 3,1,2
  4. 1,2,3
  5. Any order

90. Which of the following options is NOT supported by the ON DELETE clause of a FOREIGN KEY constraint of SQL Server 2008?

Answers:

  1. CASCADE
  2. DELETE
  3. SET NULL
  4. SET DEFAULT

91. Suppose you create a stored procedure and save it in the database with “sp_” prefix. Which of the following statements is true regarding the execution of the stored procedure?

Answers:

  1. The prefix will speed up the execution of the stored procedure.
  2. The prefix will slow down the execution of the stored procedure.
  3. The performance of the stored procedure is not affected.

92. Each table in SQL Server 2008 can have up to ______ nonclustered indexes.

Answers:

  1. 777
  2. 888
  3. 999
  4. 1000

93. Analyze the following code which uses the TOP clause of SQL Server 2008:

USE Person
GO
DECLARE @p AS int
SELECT @p=10
SELECT TOP(@p)
FROM Employee
GO

What Will be the output of the above code?

Answers:

  1. No output is displayed.
  2. A list of first 10 employees is displayed from the Person database.
  3. An incorrect syntax error is displayed.
  4. None of the above.

94. Which of the following is a valid code to remove the key used to encrypt a database using Transparent Data Encryption algorithm?

Answers:

  1. ALTER DATABASE DROP ENCRYPTION KEY
  2. DROP DATABASE ENCRYPTION KEY
  3. ALTER DATABASE REMOVE ENCRYPTION KEY
  4. REMOVE DATABASE ENCRYPTION KEY

95. What should a computed column be marked as so that SQL Server Database Engine can physically store values in a table?

Answers:

  1. ON
  2. WRITE
  3. PERSISTED

96. The output of a Transact SQL query using the GROUPING function of SQL Server 2008 is of __________ return type.

Answers:

  1. varchar
  2. boolean
  3. int
  4. tinyint

97. What is the data type of the parameter “Audit_file_offset” of function “fn_get_audit_file()” in SQL Server 2008?

Answers:

  1. varchar
  2. nvarchar
  3. int
  4. bigint

98. Which of the following queries is used to rename a database in SQL Server 2008?

Answers:

  1. sp_renamedb oldname,newname
  2. sp_renamedb newname,oldname
  3. sp_dbrename oldname,newname
  4. sp_rename oldname,newname

99. Which of the following is the correct precedence order of the data types in SQL Server 2008?

1.xml
2.text
3.bigint
4.image
5.float
6.datetime
Answers:

  1. 1,2,3,4,5,6
  2. 6,5,4,3,2,1
  3. 1,6,5,3,2,4
  4. 1,4,2,3,6,5

2,324 total views, 5 views today

Upwork .Net Technology

Knowledge of Net Framework 4.0 Skills Test 2016

Published by:

1. How will you count the odd numbers from the array shown below using LINQ in .Net framework 4.0?

int[]numbers={5,4,1,3,9,8,6,7,2,0};

Answers:

  1. int findoddNumbers = numbers.Count(n => n % 2 == 1);
  2. int findoddNumbers = numbers.Count( n % 2 == 1);
  3. int findoddNumbers = (from number in numbers where numbers%2==1 select Count());
  4. int findoddNumbers = (from number in numbers where number%2==1 select numbers).Count();

2. How do you add MetaDescription to your web page in .Net framework 4.0?

Answers:

  1. HtmlMeta meta2 = new HtmlMeta(); meta2.Name = “description”; meta2.Content = “add meta description”; Page.Header.Controls.Add(HtmlMeta );
  2. Page.MetaDescription
  3. Both a and b are correct.
  4. None of the above.

3. Consider the following code snippet:

namespace ExtensionMethods
{
public static class NumericExtensionMethods
{
public static bool IsNumeric(this string s)
{
float output;
return float.TryParse(s, out output);
}
}
}

After adding the namespace, how will you call the ExtensionMethod on the string if your string variable is defined as:

string test=”4″;

Answers:

  1. test.IsNumeric();
  2. ExtensionMethods.NumericExtensionMethods.IsNumeric();
  3. NumericExtensionMethods m = new NumericExtensionMethods(); m.IsNumeric(test);
  4. None of the above

4. What is the purpose of the System.Windows.Data namespace in .Net framework 4.0?

Answers:

  1. Using System.Windows.Data namespace, you can integrate rich media, including drawings, text, and audio/video content in Windows Presentation Foundation applications.
  2. It contains classes used for binding properties to data sources, data source provider classes, and data-specific implementations of collections and views.
  3. It provides the types that support navigation, including navigating between windows and navigation journaling.
  4. It contains classes for creating windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system.

5. Suppose you want to eliminate duplicate elements from the array

int[] source = { 7, 4, 1, 3, 9, 8, 6, 7, 2, 1, 8, 15, 8, 23}

and sort the elements in descending order using LINQ in .Net framework 4.0. Which of the following statements can you use?

Answers:

  1. var result = (from s in source orderby s select distinct s).Descending();
  2. var result = (from s in source orderby s descending select s).Distinct();
  3. var result = select distinct s from s in source sortby s descending;
  4. var result = from s in source orderby s descending group p by s select s;

6. Which of the following classes of System.Windows.Media namespace provides rendering support in WPF which includes hit testing, coordinate transformation, and bounding box calculations in .Net framework 4.0?

Answers:

  1. HitTestResult
  2. Visual
  3. Colors
  4. Brush

7. Which of the following statements is correct for ASP.NET MVC Routing in .Net Framework 4.0?

Answers:

  1. It is used to match the incoming requests and to map them to a controller action.
  2. It is used to construct the outgoing URLs which correspond to controller actions.
  3. Both a and b are correct.

8. Which of the following is NOT a valid data source control in .Net framework 4.0?

Answers:

  1. LinqDataSource
  2. XmlDataSource
  3. AccessDataSource
  4. EntityDataSource
  5. All of the above are valid data sources

9. Which of the following statements is correct for WSHttpBinding of WCF in .Net framework 4.0?

Answers:

  1. It is a secure and interoperable binding that is suitable for non-duplex service contracts.
  2. It is a secure and interoperable binding that is suitable for duplex service contracts or communication through SOAP intermediaries.
  3. It is a secure and optimized binding suitable for cross-machine communication between WCF applications.
  4. It is a queued binding that is suitable for cross-machine communication between WCF applications.

10. What result will you get when you run the following LINQ query in .Net framework 4.0?

var scoreRecords = new[] { new {Name = “Alice”, Score = 50},
new {Name = “Bob” , Score = 40},
new {Name = “Cathy”, Score = 45}
};

var scoreRecordsDict = scoreRecords.ToDictionary(sr =>sr.Name);

Response.Write(scoreRecordsDict[“Bob”]);

Answers:

  1. { Name = Bob}
  2. { Name = Bob, Score = 40 }<
  3. Name = Bob
  4. None of the above

11. Which of the following is the correct way to expand the size of application URLs in .Net framework 4.0?

Answers:

  1. <httpModules maxRequestPathLength=”260″ maxQueryStringLength=”2048″ />
  2. <httpRuntime maxRequestPathLength=”260″ maxQueryStringLength=”2048″ />
  3. <httpHandlers maxRequestPathLength=”260″ maxQueryStringLength=”2048″ />
  4. None of the above

12. How will you implement the logic for the following scenario in .Net framework 4.0?

Suppose you have a GridView with paging enabled. You select the third row on page 1 and then move to page 2. Nothing is selected on page 2. When you move back to page 1, the third row should still be selected.

Answers:

  1. Set the GridView DataKeyNames property.
  2. Set the GridView EnablePersistedSelection property to true.
  3. Set the Gridview PagerSettings-Mode property.
  4. It is not possible to implement the given logic for the scenario described above.

13. Which of the following statements is correct for the bubbling routing strategies used by the routing events in WPF in .Net framework 4.0?

Answers:

  1. This event is first raised on the root, then on each element down the tree until the source element is reached.
  2. This event is only raised on the source element. It will have the same behavior as a plain .NET event, except that such events can still participate in mechanisms specific to routed events such as event triggers.
  3. This event is first raised on the source element, then on each element up the tree until the root is reached.
  4. None of the above.

14. How many columns can you select by $orderby OData system query option in .Net Framework 4.0?

Answers:

  1. 5
  2. 12
  3. 20
  4. infinite

15. Which of the following OData system query options is used to determine the maximum number of records to be returned in .Net framework 4.0?

Answers:

  1. $top
  2. $filter
  3. $select
  4. $expand

16. How can you determine, at runtime, if your application is running in the 64-bit version of .Net framework 4.0?

Answers:

  1. Check IntPtr.Size property for a value of 8.
  2. Call the Environment.GetEnvironmentVariable method and pass in the string “Platform” as an argument. Check for a return value of “x64”.
  3. Call the WOW64 emulator method Isx64() and check the boolean return value.

17. Suppose your WCF service root URL is “http://examples.svc”. What will be the response when you request a WCF data service URL with a $skip system query option, as shown below, in .Net framework 4.0?

http://examples.svc/Products?$skip=2&$top=2&$orderby=Rating

Answers:

  1. The response will be the first two product entries from the collection of all products after sorting the collection in descending order of Rating.
  2. The response will be the third and fourth product entries from the collection of all products after sorting the collection in ascending order of Rating.
  3. The response will be the second and third product entries from the collection of all products after sorting the collection in descending order of Rating.

18. Which of the following arrays will be returned as result when you run the following LINQ query in .Net framework 4.0?

object[] varnumbers = { null, 1.0, “two”, 3, “four”, 5, “six”, 7.0 };

var doubles = varnumbers.OfType<double>();

foreach (var d in doubles)
{
Response.Write(d);
}

Answers:

  1. 1, 7
  2. null
  3. two, four, six
  4. null, 1.0, “two”, 3, “four”, 5, “six”, 7.0

19. Which of the following ASP.NET MVC namespaces includes the classes that support forms, input controls, links, partial views, and validation in .Net Framework 4.0?

Answers:

  1. System.Web.Mvc
  2. System.Web.Mvc.Async
  3. System.Web.Mvc.Html
  4. System.Web.Mvc.Sync

20. What is DLR in .Net framework 4.0?

Answers:

  1. It defines the common types that are supported by the languages which are compatible with the .Net framework.
  2. It represents the data types of different languages in a specific format specification.
  3. It is a programming language that manages the execution of programs written in any of several supported languages, allowing them to share common object-oriented classes written in any of the languages.
  4. It is a runtime environment that adds a set of services for dynamic languages to the common language runtime.

21. What is default format used to represent data returned in an ADO.NET Data Services response in .Net framework 4.0?

Answers:

  1. XAML
  2. SOAP
  3. Atom
  4. WSDL

22. Considering the image, which of the following is the correct syntax for encoding a particular string in .Net framework 4.0?

Answers:

  1. Only a
  2. Only b
  3. Both a and b

23. In WCF, what is the significance of the ReceiveRetryCount property of a Poison message in .Net framework 4.0?

Answers:

  1. It is an integer value that indicates the maximum number of times to retry delivery of a message from the application queue to the application.
  2. It is an integer value that indicates the maximum number of retry cycles.
  3. It is the time delay between retry cycles.

24. Which of the following is NOT a valid WPF Localizability attribute in .Net framework 4.0?

Answers:

  1. Readability
  2. Modifiability
  3. Category
  4. Both a and b
  5. All of the above are Localizability attributes

25. Which of the following is NOT a valid QueryExtender filter option in .Net framework 4.0?

Answers:

  1. SearchExpression
  2. RangeExpression
  3. OrderByExpression
  4. All of the above are valid QueryExtender filter options

26. What is the function of WCF Data contracts in .Net framework 4.0?

Answers:

  1. They define, for each parameter or return type, what data is serialized to be exchanged..
  2. They define which operations the client can perform on the service.
  3. They define which errors are raised by the service, and how the service handles and propagates errors to its clients.

27. Which of the following pieces of information is provided by the WCF service contract in .Net framework 4.0?

Answers:

  1. The grouping of operations in a service.
  2. The location of the operations.
  3. The specific protocols and serialization formats that are used to support successful communication with the service.
  4. All of the above.

28. Suppose your site has a page called Index.aspx that you no longer use. Search engines may keep requesting this page.

Which of the following method will you add to the CodeBehind file of Index.aspx that will send requests (including search engine requests) to Default.aspx in .Net framework 4.0?

Answers:

  1. Server.Transfer
  2. Response.Redirect
  3. Response.RedirectPermanent
  4. Server.Execute

29. How will you display the view data in the view of an ASP.NET MVC Application?

Answers:

  1. <%: ViewData[“CurrentTime”] %>
  2. <%=ViewData[“CurrentTime”] %>
  3. %ViewData[“CurrentTime”] %
  4. <ViewData[“CurrentTime”] >

30. How is data passed from controllers to views in an ASP.NET MVC Application?

Answers:

  1. Using ViewData
  2. Using ViewState
  3. Using Sessions
  4. Using Cookies

31. What result will you get when you run the following LINQ query in .Net framework 4.0?

List<string> alphabets = new List<string>() { “whats”, “new”, “in”, “aspnet” };
var alphabetsquery = from alphabet in alphabets select alphabet.Substring(0, 1);
foreach (var alpha in alphabetsquery)
{
Response.Write(alpha);
}

Answers:

  1. wnia
  2. whats
  3. whatsnewinaspnet
  4. aspnetinnewwhats

32. What is a Decorator in WPF of .Net framework 4.0?

Answers:

  1. It is used to add functional handles to elements or provide state information about a control.
  2. It is the base class for elements that apply effects onto or around a single child element, such as Border or Viewbox.
  3. It provides a set of services that can be used to extend the functionality of a common language runtime property.
  4. It is a property with the exception that its value cannot be set outside the class that declared the read-only property.

1,285 total views, 3 views today

Upwork .Net Technology

Dot Net 3.5 using C# Test 2016

Published by:

1. Which of the following are static methods of the System.Reflection Activator class? Answers:

  1. CreateComInstanceFrom<
  2. CreateInstanceFrom
  3. GetInstance
  4. CreateInstance
  5. All of the above

2. Which of the following are true about Extension methods? Answers:

  1. They must be declared static
  2. They can be declared either static or instance members
  3. They must be declared in the same assembly (but may be in different source files)
  4. Extension methods can be used to override existing instance methods
  5. Extension methods with the same signature for the same class may be declared in multiple namespaces without causing compilation errors

3. When using a DataReader to access the results of a Database operation, which of the following are true? Answers:

  1. The DataReader provides a cursor that can be used to move forward and backwards through the result.
  2. The DataReader provides random access capabilities on the result.
  3. The Application code can reference the first row of a multi-row result set faster than it can be by loading it directly into a DataTable
  4. The DataReader can provide the Schema of the result to the application code.

4. Which of the following scenarios are applicable to Window Workflow Foundation? Answers:

  1. Document-centric workflows
  2. Human workflows
  3. User-interface page flows
  4. Builtin support for communications across multiple applications and/or platforms

5. Which of the following are true about using ADO.NET DataSets and DataTables? Answers:

  1. The connection to the database must remain valid for the life of the data objects
  2. All tables in a dataset must come from the same database.
  3. A given instance of a DataTable can be in only one DataSet
  4. Changes made to multiple tables within a DataSet can easily be transferred to a new DataSet which contains only the changes
  5. Content from multiple DataSets can easily be combined into a single DataSet that contains the net result of all changes.

6. Which of the following are true with respect to the standard implementation of Garbage Collection? Answers:

  1. Objects must be set to null in order to be eligible for garbage collection
  2. Unless specific steps are taken, an object may be moved in memory
  3. Objects become eligible for garbage collection as soon as it is impossible for any code to access them
  4. Objects which implement finalizers will always have the finalizer called at some point

7. Which of the following types guarantee atomic reads and writes? Answers:

  1. int
  2. double
  3. string
  4. long
  5. float

8. Which of the following does using Initializer Syntax with a collection as shown below require? CollectionClass numbers = new CollectionClass { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; Answers:

  1. The Collection Class must implement System.Collections.Generic.ICollection<T>
  2. The Collection Class must implement System.Collections.Generic.IList<T>
  3. Each of the Items in the Initializer List will be passed to the Add<T>(T item) method
  4. The items in the initializer will be treated as an IEnumerable<T> and passed to the collection constructor+K110

9. Which features that are not supported in the System.TimeZone class does the System.TimeZoneInfo class provide? Answers:

  1. It provides readable names for both regular time and, if appropriate, daylight savings time
  2. It provides a means of enumerating the known time zones that are available on the local system
  3. It provides functionality to create custom time zones
  4. It provides the period the time zone was in effect for. For example: From 1986 to 2006, it was observed from the first Sunday in April to the last Sunday in October, but since 2007, it is being observed from the second Sunday in March to the first Sunday in November

10. Within Windows Workflow Foundation, Compensating Actions are used for: Answers:

  1. provide a means to rollback a failed transaction
  2. provide a means to undo a successfully committed transaction later
  3. provide a means to terminate an in process transaction
  4. achieve load balancing by adapting to the current activity

11. Of which elements does Generics allow parameterization by type? Answers:

  1. Classes
  2. Structs
  3. Methods
  4. Events
  5. Fields

12. Which of the following do the advantages of Lambda Expressions over Anonymous methods include? Answers:

  1. More concise syntax
  2. The types for a Lambda Expression may be omitted
  3. The body of an anonymous method can not be an expression
  4. Lambda Expressions permit deferred type interference, that anonymous methods do not
  5. All of the above

13. In which of the following types of applications can Windows Workflow Foundation be used? Answers:

  1. Console Applications
  2. Windows Forms based Applications
  3. Windows Presentation Foundation based Applications
  4. ASP.NET based applications
  5. All of the above

14. Which of the following items are recommended when using XML comments to generate documentation? Answers:

  1. <exception>
  2. <code>
  3. <summary>
  4. <events>

15. With which class is the task of mapping a specific point in time into units, such as weeks, months, and years accomplished? Answers:

  1. System.DateTime
  2. System.TimeSpan
  3. System.Globalization.Calendar
  4. System.Globalization.CultureInfo

16. Which of the following are true regarding the System.Collections.Generic.HashSet<T> class? Answers:

  1. HashSet is an unordered collection.
  2. HashSet requires that each element be unique a
    s determined by either a supplied EqualityComparer or the default EqualityComparer
  3. Operations on sets (Union, Intersection, etc) always create new result sets
  4. HashSet provides functionality for “conceptual sets” where the rules for membership can be specified without actually creating all of the items.

17. Which of the following are true regarding System.Threading.ReaderWriterLockSlim? Answers:

  1. It is optimized for single processor/core operations
  2. It is optimized for usage where writes from multiple sources are common
  3. A thread which has a read lock on a resource may not acquire a write lock on the same resource
  4. By default, a thread which has a read lock on a resource and attempts to get another read lock on the same resource will throw an exception

18. The framework provides three different timer classes. Select the answer that properly matches the class with the listed characteristic. Answers:

  1. System.Threading.Timer Simple timer which requires a delegate to be supplied for execution when the timer expires. execution of the method provided by the delegate will be invoked on a ThreadPool Thread.
  2. System.Timers.Timer: Designed for use with worker threads in a multithreaded environment. Can move among threads to handle the raised Elapsed event May result in more accuracy than System.Windows.Forms.Timer instances.
  3. System.Windows.Forms.Timer Lower Resolution timer which requires a UI message pump on the creating thread.
  4. All of the above

19. Which of the following advantages does System.Collections.IDictionaryEnumerator provide over System.Collections.IEnumerator? Answers:

  1. It adds properties for direct access to both the Key and the Value
  2. It is optimized to handle the structure of a Dictionary.
  3. It provides properties to determine if the Dictionary is enumerated in Key or Value order
  4. It provides reverse lookup methods to distinguish a Key from a specific Value

20. While using the capabilities supplied by the System.Messaging classes, which of the following are true? Answers:

  1. Information must be explicitly converted to/from a byte stream before it uses the MessageQueue class
  2. Invoking the MessageQueue.Send member defaults to using the System.Messaging.XmlMessageFormatter to serialize the object.
  3. Objects must be XMLSerializable in order to be transferred over a MessageQueue instance.
  4. The first entry in a MessageQueue must be removed from the queue before the next entry can be accessed
  5. Entries removed from a MessageQueue within the scope of a transaction, will be pushed back into the front of the queue if the transaction fails.

21. What impact will using implicitly typed local variables as in the following example have? var sample = “Hello World”; Answers:

  1. The actual type is determined at compilation time, and has no impact on the runtime
  2. The actual type is determined at runtime, and late binding takes effect
  3. The actual type is based on the native VARIANT concept, and no binding to a specific type takes place.
  4. “var” itself is a specific type defined by the framework, and no special binding takes place

22. Which of the following are true about System.GC under version 3.5 of the Framework? Answers:

  1. You can request that the garbage collector process a generation if it determines that it is appropriate at specific points in your code
  2. You can control the intrusiveness of the garbage collector (i.e. how often it performs collections) while your program is running
  3. You can control the intrusiveness of the garbage collector (i.e. how often it performs collections) only during application initialization
  4. You should specify LowLatency when using Concurrent Server Garbage Collection to improve memory utilization

23. Which of the following operators can be overloaded? Answers:

  1. Assignment (=)
  2. Conditional (&&,||)
  3. Logical (&,|,^)
  4. Shift (<<, >>)

24. Which of the following does the System.IO.Pipes namespace provide? Answers:

  1. Interprocess communication through anonymous and/or named pipes.
  2. Access to named pipes using System.IO.Stream
  3. Access to system level pipe security implemented as discretionary access control lists (DACL) and/or system access control lists (SACL),
  4. Asynchronous read and write operations
  5. All of the above

25. Which of the following statements do Expression Trees fit best? Answers:

  1. Expression trees are a data structure which can be initially composed using language syntax.
  2. Expression trees are dynamically generated code which is executed to perform the desired function.
  3. Expression trees can only be created from Lambda Expressions
  4. Expression trees can be modified once they are created
  5. All of the Above

26. By which contract are the ws-addressing action and replyaction elements of the soap envelop controllable when Windows Communication Foundation is used? Answers:

  1. ServiceContract
  2. OperationContract
  3. DataContract
  4. MessageContract

27. Which of the following are true when comparing ADO.NET with Microsoft DNA (Distributed interNet Applications)? Answers:

  1. ADO.NET provides significantly better performance.
  2. ADO.NET is better suited for communications between disparate systems/applications.
  3. ADO.NET can eliminate the need for COM components in the communication layer.
  4. DNA makes it easier to communicate across firewalled boundaries.

28. When Deleting a DataRow from the DataRowCollection of a DataTable, you can: Answers:

  1. use the DataRowCollection.Remove method to immediately delete the row.
  2. use the DataRowCollection.Remove method to mark the row for deletion when DataRow.AcceptChanges is called.
  3. use the DataRow.Delete method to immediately delete the row.
  4. use the DataRow.Delete method to mark the row for deletion when DataRowAcceptChanges is called.

29. Which of the following are required to be true by objects which are going to be used as keys in a System.Collections.HashTable? Answers:

  1. They must handle case-sensitivity identically in both the GetHashCode() and Equals() methods.
  2. Key objects must be immutable for the duration they are used within a HashTable.
  3. Get HashCode() must be overridden to provide the same result, given the same parameters, regardless of reference equalityl unless the HashTable constructor is provided with an IEqualityComparer parameter.
  4. Each Element in a HashTable is stored as a Key/Value pair of the type System.Collections.DictionaryElement
  5. All
    of the above

30. Which of the following are goals of Windows Communication Foundation? Answers:

  1. Bringing various existing communication technologies into a unified environment.
  2. Cross vendor/platform communication.
  3. Support for asynchronous communications.
  4. Support for distributed applications based on technologies such as MSMQ and/or COM+
  5. All of the above

31. Which access limitation is found in a class member declared protected internal? Answers:

  1. Access is limited to the containing class plus any classes derived from the containing class
  2. Access is limited to the current assembly
  3. Access is limited to the containing class plus any classes derived from the containing class that are also in the current assembly
  4. Access is limited to the containing class plus any classes derived from the containing class or any other class in the current assembly

32. When Windows Communication Foundation is used to develop a Web Service, which of the following are supported? Answers:

  1. WS-Addressing
  2. WS-MetadataExchange
  3. WS-Security
  4. WS-Atomic Transaction
  5. All of the above

33. To which contract is the SessionMode property to disallow, require, or permit applied when Windows Communication Foundation is used? Answers:

  1. ServiceContract
  2. OperationContract
  3. DataContract
  4. MessageContract

34. Which of the following is not supported by remoting object types? Answers:

  1. well-known singleton
  2. well-known single call
  3. client activated
  4. context-agile

35. The default number of threads per processor in the System.Threading.ThreadPool class under version 3.5 of the Framework is: Answers:

  1. 1
  2. 25
  3. 250
  4. 100
  5. 500

36. To which of the following can System.IO.IsolatedStorage not be scoped? Answers:

  1. Restricted to a Specific Application
  2. Restricted to a Specific AppDomain
  3. Restricted to a Specific User
  4. Restricted to a specific Physical Media

37. When using an automatic property, which of the following statements is true? Answers:

  1. The compiler generates a backing field that is completely inaccessible from the application code.
  2. The compiler generates a backing field that is a private instance member with a leading underscore that can be programmatically referenced.
  3. The compiler generates a backing field that is accessible via reflection
  4. The compiler generates a code that will store the information separately from the instance to ensure its security.

38. When using an implicitly typed array, which of the following is most appropriate? Answers:

  1. All elements in the initializer list must be of the same type.
  2. All elements in the initializer list must be implicitly convertible to a known type which is the actual type of at least one member in the initializer list
  3. All elements in the initializer list must be implicitly convertible to the common type which is the base type of the items actually in the list
  4. There are no restrictions on the items in the initializer list as the array is not declared to be a specific type.

39. Which of the following characteristics is present in the DateTime type? Answers:

  1. It always references the UTC (GMT) time
  2. It always references the Local time
  3. It contains a member indicating which time zone it refers to
  4. It contains a member indicating whether the time is UTC, Local, or Unspecified

40. Which of the following code samples show a valid static constructor? Answers:

  1. class Sample { public static Sample() { } }
  2. class Sample { static Sample() { } }
  3. class Sample { static Sample(int value) { } }
  4. class Sample { static void Sample() { } }

41. Which of the following are true regarding System.Web.Mail and System.Net.Mail namespaces? Answers:

  1. System.Web.Mail is not supported under version 3.5 of the Framework
  2. System.Web.Mail is deprecated under version 3.5 of the Framework, and it is officially recommended that System.Net.Mail be used.
  3. System.Web.Mail is the preferred solution when using IIS hosted applications
  4. There are no functional differences; the items were moved to a new namespace to reflect their applicability in a better way

42. In which of the following ways do structs differ from classes? Answers:

  1. Structs can not implement interfaces
  2. Structs cannot inherit from a base struct
  3. Structs cannot have events interfaces
  4. Structs cannot have virtual methods

43. To which of the following do automatic properties refer? Answers:

  1. You declare (explicitly or implicitly) the accessibility of the property and get and set accessors but do not provide any implementation or backing field
  2. You attribute a member field so that the compiler will generate get and set accessors
  3. The compiler creates properties for your class based on class level attributes
  4. They are properties which are automatically invoked as part of the object construction process

44. Given the code below, which of the following items will cause a compilation error? static void F1(params int [] y) { } static void Sample() { int [] j = new Int32[3]; List k = new List(); // ANSWER GOES HERE } Answers:

  1. F1(j);
  2. F1(k);
  3. F1(1, 2, 3);
  4. F1(new [] {1,2,3})
  5. None of the above

45. Which of the following are true about Nullable types? Answers:

  1. A Nullable type is a reference type.
  2. A Nullable type is a structure.
  3. An implicit conversion exists from any non-nullable value type to a nullable form of that type.
  4. An implicit conversion exists from any nullable value type to a non-nullable form of that type.
  5. A predefined conversion from the nullable type S? to the nullable type T? exists if there is a predefined conversion from the non-nullable type S to the non-nullable type T

46. For which of the following scenarios does Reflection.Emit provide support? Answers:

  1. Defining methods dynamically.
  2. Defining types dynamically
  3. Defining assemblies dynamically
  4. Defining Instances dynamically
  5. Exporting an executable code to a disk based assembly

47. Which of the following are true about System.Security.Cryptography under version 3.5 of the framework Answers:

  1. None of the implementations are FIPS-certified
  2. Support is provided for the “Suite B” set of cryptographic algorithms as specified by the National Security Agency (NSA) .
  3. Cryptography Next Generation (CNG) classes are supported on XP and Vista systems
  4. The System.Security.Cryptography.AesManaged class allows custom block size, iteration counts and feedback modes to support any the Rijndael based encryption.

48. Custom non-fatal exceptions should be derived from: Answers:

  1. ApplicationException
  2. DataMisalignedException
  3. ExecutionEngineException
  4. SystemException

49. class Sample { public Sample(int x) { } } In the above code, which of the following other class constructors can directly access the provided constructor? Answers:

  1. public Sample() : this(1) { }
  2. public Sample() : Sample(1) {}
  3. Both of the above
  4. One class constructor can not directly access another constructor

50. Which of the following are characteristics of the System.Threading.Timer class? Answers:

  1. The method provided by the TimerCallback delegate will always be invoked on the thread which created the timer.
  2. The thread which creates the timer must have a message processing loop (i.e. be considered a UI thread)
  3. The class contains protection to prevent reentrancy to the method provided by the TimerCallback delegate
  4. You can receive notification of an instance being Disposed by calling an overload of the Dispose method.

51. Which of the following is not an unboxing conversion? Answers:

  1. void Sample1(object o) { int i = (int)o; }
  2. void Sample1(ValueType vt) { int i = (int)vt; }
  3. enum E { Hello, World} void Sample1(System.Enum et) { E e = (E) et; }
  4. interface I { int Value { get; set; } } void Sample1(I vt) { int i = vt.Value; }
  5. class C { public int Value { get; set; } } void Sample1(C vt) { int i = vt.Value; }

52. Which of the following regarding the System.DateTimeOffset structure are true? Answers:

  1. It provides an exact point in time relative to the UTC time zone
  2. It combines a DateTime structure with a TimeZone structure
  3. It provides arithmetical operations using values with different offsets from the UTC
  4. It can be used to determine the specific TimeZone for a local time

53. Determining the availability of sufficient memory for an operation can be accomplished by: Answers:

  1. There is no supported application level means to determine if a specific amount of memory is available.
  2. using static methods of System.Runtime.MemoryFailPoint and checking the return value
  3. creating an instance of System.Runtime.MemoryFailPoint and monitoring for an InsufficientMemoryException
  4. creating an instance of System.Runtime.MemoryFailPoint and monitoring for an OutOfMemoryException

54. When using version 3.5 of the framework in applications which emit a dynamic code, which of the following are true? Answers:

  1. A Partial trust code can not emit and execute a code
  2. The generated code has no more permissions than the assembly which emitted it.
  3. It can be executed by calling System.Reflection.Emit.DynamicMethod( string name, Type returnType, Type[] parameterTypes ) without any special permissions
  4. None of the above

55. Which of the following characteristics are found in a query expression? Answers:

  1. It must begin with a from clause
  2. It must begin with a select clause
  3. It can end with a group clause
  4. An orderby clause may optionally follow a select clause

56. When using the Demand method of System.Security.IPermission, which of the following will occur? Answers:

  1. The permissions of the code which invoked the Demand method will be evaluated.
  2. For permissions which do a stack walk, an exception will occur only if NONE of the calling codes has the required permission
  3. For permissions which do a stack walk, an exception will occur if ANY of the calling codes does not have the required permission
  4. The permission levels of individual stack frames are always checked regardless of the permission type.

57. Which of the following characteristics do classes in the System.Drawing namespace such as Brush,Font,Pen, and Icon share? Answers:

  1. They encapsulate native resource and must be properly Disposed to prevent potential exhausting of resources.
  2. They are all MarshalByRef derived classes, but functionality across AppDomains has specific limitations.
  3. You can inherit from these classes to provide enhanced or customized functionality
  4. They are Value Type objects.

58. Which of the following are true regarding event declaration in the code below? class Sample { event MyEventHandlerType MyEvent; } Answers:

  1. MyEventHandlerType must be derived from System.EventHandler or System.EventHandler<TEventArgs>
  2. MyEventHandlerType must take two parameters, the first of the type Object, and the second of a class derived from System.EventArgs
  3. MyEventHandlerType may have a non-void return type
  4. If MyEventHandlerType is a generic type, event declaration must use a specialization of that type.
  5. MyEventHandlerType cannot be declared static

59. Which of the following statements apply to developing .NET code, using .NET utilities that are available with the SDK or Visual Studio? Answers:

  1. Developers can create assemblies directly from the MSIL Source Code.
  2. Developers can examine PE header information in an assembly.
  3. Developers can generate XML Schemas from class definitions contained within an assembly.
  4. Developers can strip all meta-data from managed assemblies.
  5. Developers can split an assembly into multiple assemblies.

60. Which of the following is true about C# generics? Answers:

  1. C# allows non-type template parameters
  2. C# supports explicit specialization
  3. C# allows the type parameter to be used as the base class for the generic type
  4. C# allows a generic type parameter itself to be a generic
  5. C# enforces that all codes are valid for all types of parameters

61. The output generated by the fo
llowing code will be:
string t = “This Is a Test”; t.Replace(“T”, “?”); Console.WriteLine(t); Answers:

  1. ?his Is a ?est
  2. ?his Is a ?es?
  3. This Is a Test
  4. ?his Is a Test

62. Which of the following are true about anonymous types? Answers:

  1. They can be derived from any reference type.
  2. Two anonymous types with the same named parameters in the same order declared in different classes have the same type.
  3. Anonymous types can have methods
  4. All properties of an anonymous type are read/write

63. Which of the following are true regarding multiple versions of an assembly? Answers:

  1. When multiple versions of an assembly are available on the search path (AKA private assemblies), the runtime will use the first matching assembly with a version number equal to or higher than the assembly version that was originally linked against.
  2. When assemblies are resolving in the GAC (AKA shared assemblies), both the originator and the version are considered in determining the appropriate assembly.
  3. Configuration files can be used to override the version specified at build time.
  4. Strong Names are not required to utilize .NET’s versioning capabilities

64. Which of the following are true about declarative attributes? Answers:

  1. They must be inherited from the System.Attribute.
  2. Attributes are instantiated at the same time as instances of the class to which they are applied.
  3. Attribute classes may be restricted to be applied only to application element types.
  4. By default, a given attribute may be applied multiple times to the same application element.

65. Which of the following statements are applicable to LINQ to SQL? Answers:

  1. It is an O/RM (object relational mapping) implementation.
  2. It is a set of enhancements to the DataSet and DataTable classes.
  3. It requires the use of the SQLServer as the database
  4. Because LINQ is based on Queries, it can not be used to modify the data in the database.
  5. None of the above

66. When Implementing System.EnterpriseServices.ServicedComponent derived classes, which of the following statements are true? Answers:

  1. Enabling object pooling requires an attribute on the class and the enabling of pooling in the COM+ catalog.
  2. Methods can be configured to automatically mark a transaction as complete by the use of attributes.
  3. You can configure authentication using the AuthenticationOption when the ActivationMode is set to Library.
  4. You can control the lifecycle policy of an individual instance using the SetLifetimeService method.

2,748 total views, 5 views today

Upwork .Net Technology

Dot Net 2.0 using C# Test 2016

Published by:

1. Which of the following are true when comparing built in types for equality?

Answers:

  1. Integral types are considered equal if they represent the same value.
  2. Object types are considered equal if they both refer to the same object or if both are null
  3. String types are considered equal if they have identical lengths and identical characters in each character position
  4. String types are considered equal if they have identical dimensions and identical content at each array index

2. Which of the following types guarantee atomic reads and writes?

Answers:

  1. int
  2. double
  3. string
  4. long
  5. float

3. Which of the following types are derived from System.Reflection.MemberInfo?

Answers:

  1. System.Reflection.PropertyInfo
  2. System.Reflection.EventInfo
  3. System.Type
  4. System.Reflection.InstanceInfo

4. Which of the following applies to interface inheritance?

Answers:

  1. If a class implements an interface, the implementation can be provided by a public member of a base class.
  2. A class may partially implement an interface by only declaring some of the members
  3. Interface methods may be implemented so that they are NOT directly accessible using an instance reference to the class
  4. Since interface implementation methods can not be declared private,protected, or internal, they are always accessible from any point in an application

5. Which of the following operators can be overloaded?

Answers:

  1. Assignment (=)
  2. Conditional (&&,||)
  3. Logical (&,|,^)
  4. Shift (<<, >>)

6. Which of the following are true about using the System.Messaging.MessageQueue class?

Answers:

  1. It provides communication across heterogeneous networks
  2. It provides communication when one of the endpoints may be off-line
  3. It may behave differently depending on the current operating system
  4. A new system level queue may be created simply by creating an instance of MessageQueue.

7. Which of the following characteristics are found in an iterator?

Answers:

  1. It is a statement block which may contain a yield return statement to provide the next value of the iteration
  2. It is a statement block which may contain a yield break statement to provide the next value of the iteration
  3. It is a statement block which may contain a yield return statement to indicate that the iteration is complete
  4. It is a statement block which may contain a yield break statement to indicate that the iteration is complete
  5. It is a class which implements Ienumerable

8. Which of the following are true for parameters?

Answers:

  1. Changes to value parameters always involve making a copy of the original argument
  2. Items passed as Reference Parameters must be initialized prior to the call.
  3. Output Parameters do not need to be assigned inside the method
  4. Variable Length argument lists are not supported

9. Which of the following are true about using ADO.NET DataSets and DataTables?

Answers:

  1. The connection to the database must remain valid for the life of the data objects
  2. All tables in a dataset must come from the same database.
    A given instance of a DataTable can be in only one DataSet
  3. Changes made to multiple tables within a DataSet can easily be extracted to a new DataSet which contains only the changes
  4. Content from multiple DataSets can easily be combined into a single DataSet that contains the net result of all changes.

10. Which of the following are true with respect to the standard implementation of Garbage Collection?

Answers:

  1. Objects must be set to null in order to be eligible for garbage collection
  2. Unless specific steps are taken, an object may be moved in memory
  3. Objects become eligible for garbage collection as soon as it is impossible for any code to access it
  4. Objects which implement finalizers will always have the finalizer called at some point

11. Which of the following are true about Nullable types?

Answers:

  1. A Nullable type is a reference type.
  2. A Nullable type is a structure.
  3. An implicit conversion exists from any non-nullable value type to a nullable form of that type.
  4. An implicit conversion exists from any nullable value type to a non-nullable form of that type.

12. Which of the following are true about declarative attributes?

Answers:

  1. They must be inherited from the System.Attribute.
  2. Attributes are instantiated at the same time as instances of the class to which they are applied.
  3. Attribute classes may be restricted only to be applied to application element types.
  4. By default, a given attribute may be applied multiple times to the same application element.

13. What output will be generated by the following code?

StringBuilder sb = new StringBuilder(10);
sb.AppendFormat(“1234567890123”);
Console.WriteLine(sb.Capacity);

Answers:

  1. 10
  2. 20
  3. Some value equal to or larger than 13
  4. Int32.MaxValue

14. The term Encapsulation is most commonly used to mean:

Answers:

  1. separating an item’s public interface from the actual implementation
  2. embedding content as a resource into an executable program
  3. providing a short summary description of complex operations
  4. a technique using base and derived classes

15. Which of the following are true about namespaces and assemblies?

Answers:

  1. A single assembly may contain multiple namespaces
  2. The same namespace may be used in multiple assemblies
  3. Namespaces may be aliased to provide a shorthand notation for a fully qualified identifier
  4. All of the above

16. Which of the following are true about pointers?

Answers:

  1. C# does not support the use of “*” to indicate a pointer.
  2. Pointers are a type derived from System.Object
  3. Pointers can be used as out and ref type parameters
  4. Pointer references are tracked by the garbage collector.

17. The framework provides three different timer classes. Select the answer that properly matches the class with the listed characteristic.

Answers:

  1. System.Threading.Timer A simple timer which requires a delegate to be supplied for execution when the timer expires. Execution of the method provided by the delegate will be invoked on a ThreadPool Thread.
  2. System.Timers.Timer: Designed for use with worker threads in a multithreaded environment. Can move among threads to handle the raised Elapsed event May result in more accuracy than the System.Windows.Forms.Timer instances.
  3. System.Windows.Forms.Timer A lower resolution timer which requires a UI message pump on the creating thread.
  4. All of the above

18. Transactions initiated in which of the following are supported by System.Transactions infrastructure?

Answers:

  1. SQL Server
  2. ADO.NET
  3. MSMQ
  4. Microsoft Distributed Transaction Coordinator (MSDTC).
  5. All of the above

19. Which of the following is not a valid value for DataRowState?

Answers:

  1. Added
  2. Modified
  3. Dirty
  4. Detached
  5. Deleted

20. With which class is the task of mapping a specific point in time into units, such as weeks, months, and years accomplished?

Answers:

  1. System.DateTime
  2. System.TimeSpan
  3. System.Globalization.Calendar
  4. System.Globalization.CultureInfo

21. Which of the following are required to be true by objects which are going to be used as keys in a System.Collections.HashTable?

Answers:

  1. They must handle case-sensitivity identically in both the GetHashCode() and Equals() methods.
  2. Key objects must be immutable for the duration they are used within a HashTable.
  3. Get HashCode() must be overridden to provide the same result, given the same parameters, regardless of reference equalityl unless the HashTable constructor is provided with an IEqualityComparer parameter.
  4. All of the above

22. Which of the following is NOT a valid C# preprocessor directive?

Answers:

  1. #define
  2. #line
  3. #include
  4. #error
  5. #pragma

23. Which of the following are valid as the underlying type for an enumeration?

Answers:

  1. int
  2. sbyte
  3. long
  4. All of the above

24. Which of the following can an interface NOT contain?

Answers:

  1. Methods
  2. Events
  3. Fields
  4. Indexers

25. Which of the following is true about exceptions?

Answers:

  1. Exceptions should be derived from the System.Exception, but are not required to do so.
  2. If no catch block is found for an exception, and the source is not a static constructor, a System.ThreadException will be thrown
  3. Mathematical errors such as divide by zero, or numeric overflow will generate an exception that is derived from System.Exception
  4. Every throw statement must have at least one catch block

26. Which of the following is false regarding arrays?

Answers:

  1. For reference types A and B; if a conversion from A to B exists, a conversion from A[] to B[] also exists
  2. For value types A and B; if a conversion from A to B exists, a conversion from A[] to B[] also exists
  3. Assignments to arrays elements may require a runtime check to validate the type safety of the assignment

27. Which of the following is an effect of marking resources in satellite assemblies?

Answers:

  1. It renders the resources unavailable.
  2. It ensures that resources are used only with the appropriate culture
  3. It prevents identifier collisions between multiple satellite assemblies
  4. It has no impact since access specifiers for resources are not applied.

28. When developing a managed client to be used with an existing COM Component, __________.

Answers:

  1. you should modify the COM component to enable CLR functionallity.
  2. you should use TlbImp.exe to create a managed wrapper
  3. you should use TlbExp.exe to create a managed wrapper
  4. you should enable an unsafe code

29. Which of the following is true about C# generics?

Answers:

  1. C# allows non-type template parameters
  2. C# supports explicit specialization
  3. C# allows the type parameter to be used as the base class for the generic type
  4. C# allows a generic type parameter itself to be a generic
  5. C# enforces that all codes are valid for all types of parameters

30. Which System.Runtime.Remoting class is used to store all relevant information required to generate a proxy in order to communicate with a remote object?

Answers:

  1. ObjRef
  2. MarshalByRefObject
  3. ObjectHandle
  4. RemotingServices

31. Which of the following characteristics is found in The DateTime type?

Answers:

  1. It always references the UTC (GMT) time
  2. It always references the Local time
  3. It contains a member indicating which time zone it refers to
  4. It contains a member indicating whether it is UTC, Local, or Unspecified

32. Which of the following are true about anonymous methods?

Answers:

  1. Anonymous methods have access to the local state of the containing function member.
  2. An anonymous method requires an explicit method signature
  3. An anonymous method can impact the lifetime of local variables and parameters of the containing function
  4. A struct may not declare an anonymous method which directly references member fields

33. Elements in a System.Collections.Specialized.OrderedDictionary are:

Answers:

  1. sorted by Key
  2. sorted by Element
  3. not sorted

34. Which of the following is NOT part of an assembly?

Answers:

  1. Manifest
  2. MetaData
  3. Intermediate Language Code
  4. Resources
  5. Native Executable Code

35. Which of the following characteristics do classes in the System.Drawing namespace such as Brush,Font,Pen, and Icon share?

Answers:

  1. They encapsulate native resources and must be properly Disposed to prevent potential exhausting of resources.
  2. They are Value Type objects.
  3. You can inherit from these classes to provide enhanced or customized functionality
  4. None of the Above

36. Which of the following is not a valid attribute for impacting serialization?

Answers:

  1. DataContractAttribute
  2. DataMemberAttribute
  3. EnumMemberAttribute
  4. CollectionDataContractAttribute
  5. DataObjectAttribute

37. class Sample
{
public Sample(int x) { }
}

In the above code, which of the following other class constructors can directly access the provided constructor?

Answers:

  1. public Sample() : this(1) { }
  2. public Sample() : Sample(1) {}
  3. Both the above.
  4. One class constructor can not directly access another constructor

38. Which of the following code samples will cause a compilation error?

Answers:

  1. class SampleClass {} class SampleClass<T> {}
  2. class SampleClass<T> {} class SampleClass<T,U> {}
  3. class SampleClass<T> where T : class { } class SampleClass<T> where T : struct { }
  4. class SampleClass {} class SampleClass<T> where T : class { }

39. Which of the following are true about statements?

Answers:

  1. A while statement will always execute its body at least once.
  2. A for loop will always execute its body at least once.
  3. A try statement must always include at least one catch block
  4. A case clause within a switch statement may not fall through to the next case clause

40. If two assemblies contain the same fully qualified class, which of the following will be true?

Answers:

  1. It is impossible to add a reference to both assemblies to any given assembly
  2. A new root can be added to the assemblies namespace hierarchy by the use of an extern alias
  3. The specific colliding name may be altered by using an extern alias
  4. The collision may be avoided by using a statement to provide an alias

41. Which of the following are true about delegates?

Answers:

  1. A delegate requires an instance method be supplied.
  2. A delegate instance may encapsulate only one method
  3. Delegates are not typesafe
  4. A delegate instance does not know or care about the class type of the encapsulated method

42. When Deleting a DataRow from the DataRowCollection of a DataTable, you can:

Answers:

  1. use the DataRowCollection.Remove method to immediately delete the row.
  2. use the DataRowCollection.Remove method to mark the row for deletion when DataRow.AcceptChanges is called.
  3. use the DataRow.Delete method to immediately delete the row.
  4. use the DataRow.Delete method to mark the row for deletion when DataRowAcceptChanges is called.

43. Which of the following is NOT a requirement for an application to be certified in the “Certified for Windows Program”?

Answers:

  1. Usage of system settings for size, color, and font
  2. Support for Windows “High Contrast” option
  3. Usage of sound to notify of critical information
  4. Keyboard only access to all features including menus, and controls

44. Which access limitation does a class member declared protected internal have?

Answers:

  1. Access is limited to the containing class plus any classes derived from the containing class
  2. Access is limited to the current assembly
  3. Access is limited to the containing class plus any classes derived from the containing class that are also in the current assembly
  4. Access is limited to the containing class plus any classes derived from the containing class or any other class in the current assembly

45. Which of the following operations can NOT be performed inside a catch block?

Answers:

  1. Prevention of the caught exception from leaving the catch block
  2. Allowing the original exception to propagate after it has been caught, with all of the information (including context) intact
  3. Wrapping the caught exception inside a newly created exception of a different type
  4. Generating a new exception with no information about the original exception
  5. Altering the Message , TargetSite and/or StackTrace, of the existing exception before re-throwing

46. Which of the following is not a standard service behavior supported by the System.ServiceProcess.ServiceController class members?

Answers:

  1. Start
  2. Continue
  3. Pause
  4. Restart

47. In which of the following ways do structs differ from classes?

Answers:

  1. Structs can not implement interfaces
  2. Structs cannot inherit from a base struct
  3. Structs cannot have events interfaces
  4. Structs cannot have virtual methods

48. Which of the following are true about enums?

Answers:

  1. Enums are always equated to an integral constant value
  2. A variable of the enum type will always contain one of the declared symbolic constants
  3. The declared values of an enum are always assigned sequential starting with 0
  4. The declared values of an enum must be mapped (explicitly or implicitly) to unique integral values

49. Which of the following are characteristics of the System.Threading.Timer class?

Answers:

  1. The method provided by the TimerCallback delegate will always be invoked on the thread which created the timer.
  2. The thread which creates the timer must have a message processing loop (i.e. be considered a UI thread)
  3. The class contains protection to prevent reentrancy to the method provided by the TimerCallback delegate
  4. You can receive notification of an instance being Disposed by calling an overload of the Dispose method.

50. Custom non-fatal exceptions should be derived from:

Answers:

  1. ApplicationException
  2. DataMisalignedException
  3. ExecutionEngineException
  4. SystemException

51. Which of the following are defined as a “token”?

Answers:

  1. Identifier
  2. Whitespace
  3. Punctuator
  4. Operator
  5. All of the above

52. Of which elements does Generics allow parameterization by type?

Answers:

  1. Classes
  2. Structs
  3. Methods
  4. Fields

53. To which of the following can System.IO.IsolatedStorage not be scoped?

Answers:

  1. Restricted to a Specific Application
  2. Restricted to a Specific AppDomain
  3. Restricted to a Specific User
  4. Restricted to a specific Physical Media

54. When using the Demand method of System.Security.IPermission, which of the following will occur?

Answers:

  1. The permissions of the code which invoked the Demand method will be evaluated.
  2. For permissions which do a stack walk, an exception will occur only if NONE of the calling codes has the required permission
  3. For permissions which do a stack walk, an exception will occur if ANY of the calling codes does not have the required permission
  4. The permission levels of individual stack frames are always checked regardless of the permission type.

55. Which of the following are true about event handling?

Answers:

  1. One method may handle events from different sources
  2. A single event can be handled by multiple methods
  3. Event handlers can be dynamically added and removed at runtime
  4. All of the above

56. Which of the following conditions are true regarding System.Diagnostics.Trace?

Answers:

  1. Trace is enabled for both Release and Debug initial configurations
  2. Trace can be controlled both by preprocessor directives, and compiler directives
  3. To change the severity levels which generate output, you must recompile your program
  4. All of the Above

57. Parameterized Properties in C# are__________.

Answers:

  1. not supported except for implementing an indexer.
  2. properties which take one or more parameters (e.g. to retrieve one element from a member collection)
  3. properies which use one or more attributes to control their behavior
  4. properties which can be passed as Method Parameters so they can be invoked by the called method.

58. Which System.Runtime.Remoting class is used store all relevant information required to generate a proxy in order to communicate with a remote object?

Answers:

  1. ObjRef
  2. MarshalByRefObject
  3. ObjectHandle
  4. RemotingServices

59. Determining the availability of sufficient memory for an operation can be accomplished by?

Answers:

  1. There is no supported application level means to determine if a specific amount of memory is available.
  2. using static methods of System.Runtime.MemoryFailPoint and checking the return value
  3. creating an instance of System.Runtime.MemoryFailPoint and monitoring for an InsufficientMemoryException
  4. creating an instance of System.Runtime.MemoryFailPoint and monitoring for an OutOfMemoryException

60. Which of the following is not an application entry point?

Answers:

  1. public static void Main() {}
  2. public static int Main() {}
  3. public static int Main(string[] args) {}
  4. public static int Main(string cmdline) {}
  5. private static int Main(string[] args) {}

61. What will be the output generated by the following code?
string t = “This Is a Test”;

t.Replace(“T”, “?”);

Console.WriteLine(t);

Answers:

  1. ?his Is a ?est
  2. ?his Is a ?es?
  3. This Is a Test
  4. ?his Is a Test

62. Which of the following does NOT apply to XCOPY deployment?

Answers:

  1. The appropriate version of the .NET framework must be installed.
  2. All application components must be in the application directory, or a subdirectory.
  3. Shared components can be installed as part of the XCOPY.
  4. XCOPY deployment to a non-empty target directory may have unintended side-effects

63. Which of the following are true about operator precedence?

Answers:

  1. The Conditional Operator (?:) has the lowest precedence.
  2. All binary operators are left-associative, and evaluate from left to right.
  3. The Assignment and Conditional Operators are right-associative.
  4. The Conditional And (&&) and Or (||) operators have higher precedence than the Logical And (&) and Or (|) operators.

64. Which of the following encodings are NOT supported by classes in the System.Text namespace?

Answers:

  1. ASCII
  2. Unicode
  3. UTF-7
  4. UTF-8
  5. EBCDIC

65. Which of the following can Interfaces contain?

Answers:

  1. Methods
  2. Properties
  3. Fields
  4. Conversion operators
  5. Events

66. Which of the following is a primary characteristic of System.Xml.XmlDataDocument?

Answers:

  1. It provides synchronized operations viewing the content either as an XmlDocument or as a DataSet
  2. It provides the basic abilities for XMLDocument instances to be created from or exported to DataSets
  3. It provides a limited set of capabilities compared to the System.Xml.XmlDocument class
  4. It provides the basic abilities to allow DataSets to be loaded from or exported to XML files.

1,614 total views, 2 views today

Upwork .Net Technology

ASP.Net 3.5 using VB Test 2016

Published by:

1. Which of the following mechanisms are not suitable for returning a single row from a DataTable containing a large number of records?

Answers:

  1. DataTable.Rows.Find
  2. DataTable.Rows.Select
  3. DataTable.Select
  4. Enumerating across DataTable.Rows

2. Given the following code, which of the following are syntactically correct?

<Extension()> _
Public Function AppendTest(ByVal s As String, ByVal suffix As String)
Return s & suffix
End Function

Answers:

  1. Dim s As String = “test” s = s.AppendTest(s, “suffix”)
  2. Dim s As String = “test” s = s.AppendTest(“suffix”)
  3. Dim s As String = “test” s = AppendTest(s, “suffix”)
  4. Dim s As String = “test” s = AppendTest(“suffix”)

3. Which of the following types guarantee atomic reads and writes?

Answers:

  1. int
  2. double
  3. string
  4. long
  5. float

4. Which of the following are true regarding validation in an ASP.NET application?

Answers:

  1. Server validation should only be used when there is no client side validation.
  2. All data should be validated on the server side.
  3. Client Side validation typically provides a faster response (feedback) time than server validation
  4. A page can not be posted back unless all client validation has passed.

5. Which of the following are true of using ADO.NET DataSets and DataTables?

Answers:

  1. The connection to the database must remain valid for the life of the data objects
  2. All tables in a dataset must come from the same database.
  3. A given instance of a DataTable can be in only one DataSet
  4. Changes made to multiple tables within a DataSet can easily be transferred to a new DataSet which contains only the changes
  5. Content from multiple DataSets can easily be combined into a single DataSet that contains the net result of all changes.

6. What is the result of the following code?

Console.WriteLine(CBool(If(1>2, “True”, “False”)))

Answers:

  1. Throws an InvalidCastException
  2. TRUE
  3. FALSE
  4. None of the above

7. Given the following code, which calls are valid ways to add the elements of a string array to a List(Of String)?

Dim values() As String = {“1”, “2”, “3”, “4”}
Dim valueList As New List(Of String)

Answers:

  1. valueList.Insert(values)
  2. valueList = values
  3. valueList.Add(values)
  4. valueList.AddRange(values)

8. Determining the availability of sufficient memory for an operation can be accomplished by:

Answers:

  1. There is no supported application level means to determine if a specific amount of memory is available.
  2. using static methods of System.Runtime.MemoryFailPoint and checking the return value
  3. creating an instance of System.Runtime.MemoryFailPoint and monitoring for an InsufficientMemoryException
  4. creating an instance of System.Runtime.MemoryFailPoint and monitoring for an OutOfMemoryException

9. With which of the following are Declarative Databinding expressions delimited?

Answers:

  1. <%# %>
  2. <%– –%>
  3. <!– –>
  4. <# >

10. Which of the following are valid mechanisms for adding an event handler for Public Event SomeEvent() on class Sample?

Answers:

  1. AddHandler Sample.SomeEvent AddressOf MyEventHandler Public Sub MyEventHandler
  2. AddHandler Sample.SomeEvent, AddressOf Sample.SomeEvent
  3. Private WithEvents sample As New Sample Public Sub MyEventHandler(sender As Object, e As EventArgs) Handles sample.SomeEvent
  4. Private WithEvents sample As New Sample Public Sub MyEventHandler() Handles sample.SomeEvent

11. What does the AndAlso operator do?

Answers:

  1. It performs a Boolean AND operation, evaluating both operands
  2. It performs a Boolean AND operation, evaluating the left-hand side only if the right-hand side is false
  3. It performs a Boolean AND operation, evaluating the right-hand side only if the left-hand side is false
  4. It performs a Boolean AND operation, evaluating the right-hand side only if the left-hand side is true
  5. None of the above

12. With which class is the task of mapping a specific point in time into units such as weeks, months, and years accomplished?

Answers:

  1. System.DateTime
  2. System.TimeSpan
  3. System.Globalization.Calender
  4. System.Globalization.CultureInfo

13. By which of the following can the .NET class methods be included in .aspx files?

Answers:

  1. Including .Net code within the script element with the runat attribute set to server
  2. Including .Net code within the code element
  3. Including .Net code using the @code directive on the page
  4. Including .Net code within the execute attribute of the individual control

14. Which of the following can you do when deleting a DataRow from the DataRowCollection of a DataTable?

Answers:

  1. Use the DataRowCollection.Remove method to immediately delete the row.
  2. Use the DataRowCollection.Remove method to mark the row for deletion when DataRow.AcceptChanges is called.
  3. Use the DataRow.Delete method to immediately delete the row.
  4. Use the DataRow.Delete method to mark the row for deletion when DataRowAcceptChanges is called.

15. Which of the following events should be used for assigning a Theme dynamically to a page?

Answers:

  1. PreInit
  2. Init
  3. PreLoad
  4. PreRender
  5. Render

16. Which of the following is applicable when using Secure Socket Level communications?

Answers:

  1. A certificate must be installed on the server.
  2. The certificate must match the web address to prevent a browser warning or error
  3. The certificate must be issued by an authority recognized by the client computer to prevent a browser warning or error
  4. Once issued, a certificate is always valid until the expiration date.

17. Which of the following is true about VB generics?

Answers:

  1. VB allows non-type template parameters
  2. VB supports explicit specialization
  3. VB allows the type parameter to be used as the base class for the generic type
  4. VB allows a generic type parameter itself to be a generic
  5. VB enforces that all codes are valid for all types of parameters

18. In which of the following ways do Structures differ from classes?

Answers:

  1. Structures cannot implement interfaces
  2. Structures cannot inherit from a base structure
  3. Structures cannot have events
  4. Structures cannot have overrideable methods

19. The earliest event in which all viewstate information has been restored is:

Answers:

  1. Init
  2. PreLoad
  3. Load
  4. PreRender
  5. Render

20. Which method calls will compile the following?

Private Sub Sample(ByVal number As Integer, Optional ByVal bool As Boolean = True)
End Sub

Answers:

  1. Sample(1, True)
  2. Sample(1)
  3. Sample(bool:=False)
  4. Sample(bool:=False, number:=1)
  5. Sample(bool:=False, 1)

21. The rights of which Windows Account does anonymous Web Site access use by default?

Answers:

  1. Administrator
  2. IUSER_MachineName (where the MachineName is the actual computer name)
  3. ASPNET
  4. Guest

22. In order to enable AJAX Functionality, which control is placed on the page?

Answers:

  1. asp:ScriptManager
  2. asp:AjaxManager
  3. asp:PageManager
  4. asp:ClientScriptManager

23. Via which of the following is ViewState maintained by default?

Answers:

  1. A hidden variable within the page that is included with each round tip.
  2. A cookie which resides on the client’s computer
  3. A server side in-process memory cache
  4. Instance member variables of the Page class

24. In order to use the AJAX AuthenticationSErvice class, which of the following must be true?

Answers:

  1. It must be enabled in the web.config of the ASP.Net application.
  2. Forms Authentication must be enabled in the web.config of the ASP.Net Application
  3. Cookies must be enabled in the browser
  4. A redirection url must be supplied for successful login.
  5. All of the above.

25. In the following example,by which technique can the method Test in the derived class Cat access the implementation of MakeNoise in the base class?

Public Class Animal
Public Overridable Sub MakeNoise()
End Sub
End Class

Public Class Cat

Answers:

  1. Once overridden, the base class members are inaccessible rom the derived class.
  2. Public Sub Test() Animal.MakeNoise() End Sub
  3. Public Sub Test() MyBase.MakeNoise() End Sub
  4. Public Sub Test() CType(Me, Animal).MakeNoise() End Sub

26. Which of the following will be executed without error?

Public Class Fruit
End Class

Public Class Apple
Inherits Fruit
End Class

Answers:

  1. Dim list As New List(Of Fruit) list.Add(New Apple) list.Add(New Fruit) Dim apple As Apple = list(0)
  2. Dim list As New List(Of Fruit) list.Add(New Apple) list.Add(New Fruit) Dim fruit As Fruit = list(0)
  3. Dim list As New List(Of Apple) list.Add(New Apple) list.Add(New Fruit) Dim apple As Apple = list(0)
  4. Dim list As New List(Of Apple) list.Add(New Apple) list.Add(New Fruit) Dim fruit As Fruit = list(0)

27. Which of the following are true when using a POST command to access a WebService method?

Answers:

  1. There is a size limitation on the parameters that can be passed
  2. A query string is used to pass the parameters.
  3. By default, JSON formatting is used for serialization
  4. By default, XML formatting is used for serialization
  5. The data is automatically deserialized into .NET types before the actual Web Service method is invoked.

28. The earliest event where one can be assured all child controls exist is:

Answers:

  1. Load
  2. LoadComplete
  3. PreRender
  4. Init

29. Identify the syntactically correct LINQ query or queries, assuming dt is a DataTable

Answers:

  1. Dim result = (From r In dt Select r.Field(Of Int32)(“Value”)).Max
  2. Dim result = Select r.Field(Of Int32)(“Value”)).Max From dt
  3. Dim result = Select Max(“Value”) From dt.AsEnumerable
  4. Dim result = Aggregate r In dt Into Max(r.Field(Of Integer)(“value”))

30. By which contract are the WS-Addressing action and reply action elements of the soap envelope controllable when the Windows Communication Foundation is used?

Answers:

  1. ServiceContract
  2. OperationContract
  3. DataContract
  4. MessageContract

31. Which of the following differentiates a UserControl from a Custom Server control?

Answers:

  1. UserControl can directly express rendering information via markup; a Custom Server control can not.
  2. UserControl does not require the use of the @Register directive; a Custom Server control does require it.
  3. UserControl can make use of script based validation; a Custom Server control can not.
  4. UserControl can represent complete compositate hierarchy; a Custom Server control can not.

32. In which file are Predefined Client Side Validation Scripts defined?

Answers:

  1. WebUIValidation.js
  2. ClientValidation.js
  3. AspNetValidation.js
  4. USerValidation.js

33. Identify the syntactically correct LINQ query or queries, assuming dt is a DataTable

Answers:

  1. Dim key As String = “test” Dim result = From r In Dt Where r(0) = key Select r(1)
  2. Dim key As String = “test” Dim result = From r In dt.AsEnumerable Where r(0) = key Select r(1)
  3. Dim key As String = “test” Dim result = Select r(1) From r In Dt Where r(0) = key
  4. Dim key As String = “test” Dim result = Select r(1) From r In Dt.AsEnumerable Where r(0) = key

34. What is the result of Console.WriteLine(“{0}:{1}:{2}”, CInt(2.5), CInt(1.5), Fix(1.5))?

Answers:

  1. 2:2:2
  2. 3:2:2
  3. 3:2:1
  4. 2:2:1

1,330 total views, 2 views today

Upwork .Net Technology

ASP.Net 3.5 using C# Test 2016

Published by:

1. Which of the following does using Initializer Syntax with a collection as shown below require?

CollectionClass<int> numbers = new CollectionClass<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

Answers:

  1. Collection Class must implement System.Collections.Generic.ICollection<T>
  2. Collection Class must implement System.Collections.Generic.IList<T>
  3. Each of the Items in the Initializer List will be passed to the Add<T>(T item) method

2. Which of the following types guarantee atomic reads and writes?

Answers:

  1. int
  2. double
  3. long
  4. float

3. Which of the following accurately describes the class structure when implementing an ASP.Net page which uses the CodeFile attribute?

Answers:

  1. The actual instantiated class is dynamically created and has a base class defined in the CodeFile.
  2. The actual instantiated class is dynamically created and has a member representing the class defined in the CodeFile.
  3. The actual instantiated class is dynamically created and is a co-class of the class defined in the CodeFile.

4. Which of the following does Event Bubbling allow composite controls to perform?

Answers:

  1. Propagate container related events to the child controls.
  2. Propagate child events up to control hierarchy
  3. Distribute events between peer child controls.
  4. Translate control unhandled control events into exceptions.

5. With which of the following are Declarative Databinding expressions delimited?

Answers:

  1. <%# %>
  2. <%– –%>
  3. <!– –>
  4. <# >

6. Which of the following are true of using ADO.NET DataSets and DataTables?

Answers:

  1. The DataSets and DataTables objects requires continuous connection to the database
  2. All tables in a dataset must come from the same database
  3. A given instance of a DataTable can be in only one DataSet
  4. Content from multiple DataSets can easily be combined into a single DataSet that contains the net result of all changes

7. Which of the following controls allows the use of XSL to transform XML content into formatted content?

Answers:

  1. System.Web.UI.WebControls.Xml
  2. System.Web.UI.WebControls.Xslt
  3. System.Web.UI.WebControls.Substitution
  4. System.Web.UI.WebControls.Transform

8. The following are the two statements regarding the DataRow from the DataRowCollection of a DataTable

Statement X: Use the DataRowCollection.Remove method to immediately delete the row.
Statement Y: Use the DataRow.Delete method to mark the row for deletion when DataRow.AcceptChanges is called.

Answers:

  1. Statement X is correct and Statement Y is incorrect
  2. Statement X is incorrect and Statement Y is correct
  3. Both Statements X, Y are correct
  4. Both Statements X, Y are incorrect

9. Which of the following can be used to preserve application state information?

Answers:

  1. ApplicationState
  2. SessionState
  3. ViewState
  4. All of the above

10. When using asynchronous partial updates with an UpdatePanel, which of the following are true?

Answers:

  1. Only the UpdatePanel and any child controls go through the server lifecycle.
  2. The entire page always goes through the entire lifecycle.
  3. Only the UpdatePanel which initiated the Postback and its child controls can provide updated information.
  4. UpdatePanels can not be used with Master Pages.

11. Which of the following are required to be true by objects which are going to be used as keys in a System.Collections.HashTable?

Answers:

  1. They must handle case-sensitivity identically in both the GetHashCode() and Equals() methods.
  2. Key objects must be immutable for the duration they are used within a HashTable.
  3. Get HashCode() must be overridden to provide the same result, given the same parameters, regardless of reference equality unless the HashTable constructor is provided with an IEqualityComparer parameter.
  4. Each Element in a HashTable is stored as a Key/Value pair of the type System.Collections.DictionaryElement
  5. All of the above

12. Which of the following are true regarding the System.Collections.Generic.HashSet<T> class?

Answers:

  1. HashSet is an unordered collection.
  2. The default EqualityComparer checks whether the element supplied to the HashSet is unique or not.
  3. HashSet provides functionality for “conceptual sets” where the rules for membership can be specified without actually creating all of the items.

13. Which of the following is not a characteristic, that a Query expression should have?

Answers:

  1. It must contain a from clause
  2. It must begin with a select clause
  3. It can end with a group clause

14. Which of the following is false about declarative attributes?

Answers:

  1. They must be inherited from the System.Attribute.
  2. Attribute classes may be restricted to be applied only to application element types.
  3. By default, a given attribute may be applied multiple times to the same application element.

15. When using a JavaScript timer control in conjunction with UpdatePanels, which of the following statements are true?

Answers:

  1. The interval will never restart before the page postback is complete.
  2. The timer control must be located outside of the UpdatePanel
  3. If the timer expiration triggers a postback while a previous postback is in progress, the first postback is canceled.
  4. The timer must always be specified as a trigger for the updatepanel which is to be update when the interval expires.

16. What is the proper declaration of a method which will handle the following event?

Class MyClass
{
public event EventHandler<MyArgs> MyEvent;
}

Answers:

  1. public void A_MyEvent(object sender, MyArgs e) { }
  2. public void A_MyEvent(object sender, EventArgs e) { }
  3. public void A_MyEvent(MyArgs e) { }

17. Which of the following is/are applicable while using Secure Socket Level communications?

Answers:

  1. A certificate must be installed on the server.
  2. The certificate must match the web address to prevent a browser warning or error
  3. The certificate must be issued by an authority recognized by the client computer to prevent a browser warning or error
  4. All of the above

18. Which of the following is false about System.GC under version 3.5 of the .NET Framework?

Answers:

  1. You can request that the garbage collector processes a generation if it determines that it is appropriate at specific points in your code
  2. You can control the intrusiveness of the garbage collector (how often it performs collections) while your program is running
  3. You can control the intrusiveness of the garbage collector (how often it performs collections) only during application initialization

19. Where should an instance of an object which provides services to all users be stored?

Answers:

  1. ApplicationState
  2. SessionState
  3. ViewState
  4. None of the above

20. When using an automatic property, which of the following statements is true?

Answers:

  1. The compiler generates a backing field that is completely inaccessible from the application code.
  2. The compiler generates a backing field that is accessible via reflection.
  3. The compiler generates a code that will store the information separately from the instance to ensure its security.

21. The output generated by the following code will be:

string t = @”ThisIsaTest”;
Response.Write(t);

Answers:

  1. ThisIsaTest
  2. ThisIsaTest
  3. It will give a compilation error: Unrecognized escape sequence

22. Which of the following statements are applicable in LINQ to SQL?

Answers:

  1. It is pure Object Relational (O/R) model.
  2. It is a set of enhancements to the DataSet and DataTable classes.
  3. It requires the use of SQLServer as the database.
  4. Because LINQ is based on Queries, it can not be used to modify the data in the database.

23. Which of the following attributes of the ProcessModel element of the Machine.Config file, is used to specify the level of authentication for DCOM security?

Answers:

  1. comAuthenticationLevel
  2. comImpersonationLevel
  3. maxIoThreads
  4. requestQueueLimit

24. With which class is the task of mapping a specific point in time into units such as weeks, months, and years accomplished?

Answers:

  1. System.Globalization.CultureInfo
  2. System.Globalization.Calendar
  3. System.DateTime

25. Which of the following are common methods of supplying “Help” information to an ASP.NET application?

Answers:

  1. Setting the ToolTip property of a control to a string containing the information.
  2. using the open method of the browser window object to open a new browser window and display a help related ASP.NET page
  3. Using the showHelp method of the browser window object to display a topic from a compiled help file (.chm).
  4. All of the above

26. By which of the following can the .NET class methods be included in .aspx files?

Answers:

  1. Including .Net code within the script element with the runat attribute set to server
  2. Including .Net code within the code element
  3. Including .Net code using the @code directive on the page
  4. Including .Net code within the execute attribute of the individual control

27. Which of the following is not an unboxing conversion?

Answers:

  1. void Sample1(object o) { int i = (int)o; }
  2. void Sample1(ValueType vt) { int i = (int)vt; }
  3. enum E { Hello, World} void Sample1(System.Enum et) { E e = (E) et; }
  4. class C { public int Value { get; set; } } void Sample1(C vt) { int i = vt.Value; }

28. Which of the following can be used to control caching within an ASP.NET application?

Answers:

  1. Using the @OutputCache directive in the .aspx file.
  2. Setting the HttpCachePolicy of the Cache property inside the Response object.
  3. Using the Cache property of the Page Object.
  4. All of the above

29. What will be the impact of using implicitly typed local variables as in the following example?

var sample = “Hello World”;

Answers:

  1. The actual type is determined at compilation time, and has no impact on the runtime
  2. The actual type is determined at runtime, and late binding takes effect
  3. “var” itself is a specific type defined by the framework, and no special binding takes place

30. The earliest event in which all viewstate information has been restored is:

Answers:

  1. Init
  2. PreLoad
  3. Load
  4. Render

31. Which of the following items are recommended when using XML comments to generate documentation?

Answers:

  1. <exception>
  2. <code>
  3. <summary>
  4. All of the above

32. Which of the following conditions can trigger the automatic recycling of an ASP.NET application hosted in IIS?

Answers:

  1. A specific number of requests to the application process.
  2. A percentage of physical memory utilized by the process.
  3. A specific time interval
  4. All of the above

33. To which of the following do automatic properties refer?

Answers:

  1. You declare (explicitly or implicitly) the accessibility of the property and get and set accessors, but do not provide any implementation or backing field
  2. You attribute a member field so that the compiler will generate get and set accessors
  3. The compiler creates properties for your class based on class level attributes
  4. They are properties which are automatically invoked as part of the object construction process

34. Which of the following are true regarding System.Web.Mail and System.Net.Mail namespaces?

Answers:

  1. System.Web.Mail is not supported under version 3.5 of the Framework
  2. System.Web.Mail is deprecated under version 3.5 of the Framework, and it is officially recommended that System.Net.Mail be used.
  3. System.Web.Mail is the preferred solution when using IIS hosted applications
  4. There are no functional differences; the items were moved to a new namespace to better reflect their applicability

35. Which of the following differentiates a UserControl from a Custom Server control?

Answers:

  1. UserControl can directly express rendering information via markup; a Custom Server control can not.
  2. UserControl does not require the use of the @Register directive; a Custom Server control does require it.
  3. UserControl can make use of script based validation; a Custom Server control can not.
  4. UserControl can represent complete compositate hierarchy; a Custom Server control can not.

36. Which of the following is/are true regarding validation in an ASP.NET application?

Answers:

  1. Server validation can be used alongside with client side validation.
  2. All data posted on Server, should be validated.
  3. Client Side validation typically provides a faster response (feedback) time than server validation.
  4. All of the above

37. When using Cascading Style Sheets (CSS) to format output, which of the following is/are true?

Answers:

  1. Styles can be applied to all elements having the same CSS Class attribute
  2. Styles can be applied to specific elements based on their ID attribute
  3. Styles can be applied to elements based on their position in a hierarchy
  4. Styles can be used to invoke script based code
  5. All of the above

38. The following are two statements related to System.DateTimeOffset namespace.

Statement X: DateTimeOffset values can be converted to DateTime values and vice versa.
Statement Y: DateTimeOffset does not supports arithmetical operations

Answers:

  1. Statement X is incorrect and Statement Y is correct
  2. Statement X is correct and Statement Y is incorrect
  3. Both Statements X, Y are correct
  4. Both Statements X, Y are incorrect

39. Which of the following statements is false about Passport Authentication?

Answers:

  1. The Passport SDK must be installed.
  2. Passport authentication requires a network path between the Client and the Microsoft Passport Server
  3. Passport Authentication provides persistent authentication across sessions

40. When using a DataReader to access the results of a Database operation, which of the following is true?

Answers:

  1. The DataReader provides a cursor that can be used to move forward and backwards through the result.
  2. The DataReader provides random access capabilities on the result.
  3. The DataReader can provide the Schema information of the result to the application code.

41. In which file are Predefined Client Side Validation Scripts defined?

Answers:

  1. WebUIValidation.js
  2. ClientValidation.js
  3. AspNetValidation.js
  4. USerValidation.js

42. Which directive allows the utilization of a custom web control in an ASP.NET page?

Answers:

  1. @Register
  2. @Include
  3. @Control
  4. @Import

43. Which of the following are true about System.Security.Cryptography under version 3.5 of the framework?

Answers:

  1. Support is provided for the “Suite B” set of cryptographic algorithms as specified by the National Security Agency (NSA).
  2. Cryptography Next Generation (CNG) classes are supported on XP and Vista systems.
  3. The System.Security.Cryptography.AesManaged class allows custom block size, iteration counts and feedback modes to support any Rijndael based encryption.

44. In order to enable AJAX Functionality, which control is placed on the page?

Answers:

  1. asp:ScriptManager
  2. asp:AjaxManager
  3. asp:PageManager
  4. asp:ClientScriptManager

45. Determining the availability of sufficient memory for an operation can be accomplished by:

Answers:

  1. creating an instance of System.Runtime.MemoryFailPoint and monitoring for an InsufficientMemoryException
  2. creating an instance of System.Runtime.MemoryFailPoint and monitoring for an OutOfMemoryException
  3. There is no supported application level means to determine if a specific amount of memory is available.

46. Custom non-fatal exceptions should be derived from:

Answers:

  1. ApplicationException
  2. DataMisalignedException
  3. ExecutionEngineException
  4. SystemException

47. Which of the following events should be used for assigning a Theme dynamically to a page?

Answers:

  1. PreInit
  2. Init
  3. PreLoad
  4. PreRender
  5. Render

48. Which of the following are performed to fully debug an ASP.NET Application running on the same machine as the debugger?

Answers:

  1. Enabling debug information in the .NET Assembly
  2. Setting the debug attribute of the compilation element to true in the web.config file.
  3. Enabling ASP.NET debugging in the IIS metabase.

49. Which of the following is true about C# generics?

Answers:

  1. C# allows non-type template parameters
  2. C# supports explicit specialization
  3. C# allows the type parameter to be used as the base class for the generic type
  4. C# enforces that all codes are valid for all types of parameters

50. Which of the following are the goals of the Windows Communciation Foundation?

Answers:

  1. Bringing various existing communication technologies into a unified environment.
  2. Cross vendor/platform communication.
  3. Support for asynchronous communications.
  4. Support for distributed applications based on technologies such as MSMQ and/or COM+
  5. All of the above

51. The rights of which Windows Account does anonymous Web Site access use by default?

Answers:

  1. Administrator
  2. IUSER_MachineName (where the MachineName is the actual computer name)
  3. ASPNET
  4. Guest

52. Which of the following can one use to detect the user’s current language?

Answers:

  1. Examining the UserLanguages property of the current Request object.
  2. Examining the CurrentCulture property of the current Request object.
  3. Examining the Language property of the current Page object.

53. Which of the following are included in the advantages of Lambda Expressions over Anonymous methods?

Answers:

  1. More concise syntax
  2. The types for a Lambda Expression may be omitted
  3. The body of an Anonymous method can not be an expression
  4. Lambda Expressions permit deferred type inference, that anonymous methods do not
  5. All of the above

54. Which of the following is/are true regarding the use of Authentication to control access to the HTML file (.htm or .html)?

Answers:

  1. ASP.NET authentication handles these by default in a manner equivalent to .aspx pages
  2. ASP.NET authentication can be associated with these extensions using aspnet_isapi.dll in IIS 6.0, for the appropriate directory
  3. ASP.NET authentication cannot be used for this purpose

55. Which of the following are true about Nullable types?

Answers:

  1. A Nullable type is a reference type.
  2. An implicit conversion exists from any non-nullable value type to a nullable form of that type.
  3. A predefined conversion from the nullable type S? to the nullable type T? exists if there is a predefined conversion from the non-nullable type S to the non-nullable type T

56. The default number of threads per processor in the System.Threading.ThreadPool class under version 3.5 of the Framwork is:

Answers:

  1. 1
  2. 25
  3. 250
  4. 100
  5. 500

57. Where should information about a control created at design time be stored?

Answers:

  1. ApplicationState
  2. SessionState
  3. ViewState
  4. None of the above

58. Given the code below, which items will cause a compilation error?

static void F1(params int [] y)
{
}

static void Sample()
{
int [] j = new Int32[3];
List k = new List();
// ANSWER GOES HERE
}

Answers:

  1. F1(j);
  2. F1(k);
  3. F1(1, 2, 3);
  4. F1(new [] {1,2,3})
  5. None of the above

59. In which of the following events, the final changes to the contents of the page or its controls could be made.

Answers:

  • Load
  • LoadComplete
  • PreRender
  • Init

60. Which of the following is used to remove a cookie from a client machine?

Answers:

  • Remove the cookie from the System.Web.UI.Page.Request.Cookies collection.
  • Remove the cookie from the System.Web.UI.Page.Request.Browser.Cookies collection.
  • Set the Expires property to DateTime.Now for a cookie in the Web.UI.Page.Response.Cookies
  • Remove the cookie from the System.Web.UI.Page.Response.Cookies collection.

61. When Windows Communication Foundation is used to develop a Web Service, which of the following are supported?

Answers:

  1. WS-Addressing
  2. WS-MetadataExchange
  3. WS-Security
  4. WS-Atomic Transaction
  5. All of the above

62. To which contract is the SessionMode property to disallow, require, or permit applied when Windows Communication Foundation is used?

Answers:

  1. ServiceContract
  2. OperationContract
  3. DataContract
  4. MessageContract

63. Via which of the following is ViewState maintained by default?

Answers:

  1. A hidden variable within the page that is included with each round tip.
  2. A cookie which resides on the client�s computer
  3. A server side in-process memory cache
  4. Instance member variables of the Page class

64. Which of the following are true about Extension methods.

Answers:

  1. They can be declared either static or instance members
  2. They must be declared in the same assembly (but may be in different source files)
  3. Extension methods can be used to override existing instance methods
  4. Extension methods with the same signature for the same class may be declared in multiple namespaces without causing compilation errors

65. In order to use the AJAX AuthenticationService class, which of the following must be true?

Answers:

  1. It must be enabled in the web.config of the ASP.Net application.
  2. Forms Authentication must be enabled in the web.config of the ASP.Net Application
  3. Cookies must be enabled in the browser
  4. A redirection url must be supplied for successful login.

2,173 total views, 4 views today

Upwork .Net Technology

C# Test 2016

Published by:

1. Which of the following define the rules for .NET Languages?

Answers:

  1. GAC
  2. CLS
  3. CLI
  4. CTS
  5. CLR
  6. JIT

2. What is the syntax required to load and use a normal unmanaged windows DLL (e.g. kernel32.DLL) in a managed .NET C# code?

Answers:

  1. Assembly.Load(”Kernel32.DLL”)
  2. LoadLibrary(”Kernel32.DLL”)
  3. [DllImport(”kernel32”, SetLastError=true)]
  4. Unmanaged DLLs cannot be used in a managed .NET application.

3. Suppose there is a List of type Person with a property of LastName(string) and PopulateList is a function which returns a Generic List of type Person:
List<Person> people = PopulateList();

What does the statement below do?
people.Sort((x, y) => string.Compare(x.LastName, y.LastName));

Answers:

  1. It will return a newly created sorted List.
  2. It will throw a compiler error.
  3. It will sort the string in place.
  4. It will throw InvalidOperationException at runtime.

4. Which of the following will correctly remove duplicates from a List<T>?

Answers:

  1. Int32 index = 0; while (index < list.Count + 1) { if (list[index] == list[index + 1]) list.RemoveAt(index); else index–; }
  2. List<T> withDupes = LoadSomeData(); List<T> noDupes = new List<T>(new HashSet<T>(withDupes)); withDupes.AddRange(noDupes);
  3. List<T> withDupes = LoadSomeData(); List<T> noDupes = withDupes.Distinct().ToList();
  4. List<T> withDupes = LoadSomeData(); var hs = new HashSet<T>(withDupes); withDupes.All( x => hs.Add(x) );

5. Is it possible to define custom Exception classes in C#?

Answers:

  1. Yes
  2. Yes, but they have to be derived from System.Exception class
  3. Yes, but they have to be derived from System.Object class
  4. No

6. Which type of class members are associated with the class itself rather than the objects of the class?

Answers:

  1. Public
  2. Protected
  3. Private
  4. Static

7. What is the output of the following code?

class Test
{
static void Main() {
string myString = “1 2 3 4 5”
myString = Regex.Replace(myString, @”s+”, ” “);
System.Console.WriteLine(myString);
}

Answers:

  1. 12345
  2. 1 2 3 4 5
  3. 54321
  4. 5 4 3 2 1

8. Which of the following will block the current thread for a specified number of milliseconds?

Answers:

  1. System.Threading.Thread.Sleep(50);
  2. System.Threading.Thread.SpinWait(50);
  3. System.Threading.Thread.Yield();
  4. None of these.

9. What is the problem with the following function, which is supposed to convert a Stream into byte array?
public static byte[] ReadFully(Stream input)
{
using (MemoryStream ms = new MemoryStream())
{
input.CopyTo(ms);
return ms.ToArray();
}
}

Answers:

  1. It will work only in .NET Framework 4 or above, as the CopyTo function of the memory stream is available only in .NET Framework 4 or later versions.
  2. It will work only in .NET Framework 3.5 or below, as the CopyTo function of the memory stream is available only in .NET Framework 3.5 or earlier versions.
  3. It will work in all versions of the .NET framework.
  4. None of these.

10. Which of the following functions are used to wait for a thread to terminate?

Answers:

  1. Wait()
  2. Terminate()
  3. Join()
  4. Abort()

11. _____________ helped overcome the DLL conflict faced by the C# language versions prior to .NET.

Answers:

  1. CLR
  2. JIT
  3. CTS
  4. GAC
  5. Satellite Assemblies
  6. All of these

12. What is the benefit of using a finally{} block with a try-catch statement in C#?

Answers:

  1. The finally block is always executed before the thread is aborted.
  2. The finally block is never executed before the thread is aborted.
  3. The finally block is never executed after the thread is aborted.
  4. The finally block is always executed before the thread is started.

13. In which of the following namespaces is the Assembly class defined?

Answers:

  1. System.Assembly
  2. System.Reflection
  3. System.Collections
  4. System.Object

14. Which of the following statements is true regarding predicate delegates in C#?

Answers:

  1. Predicate delegates are used for filtering arrays.
  2. Predicate delegates are references to functions that return true or false.
  3. Predicate delegates are only used in System.Array and System.Collections.Generic.List classes.
  4. Predicate delegates are only used in ConvertAll and ForEach methods.

15. Working with a list of Employees:
List<Employee> lstEmployees = new List<Employee>
{
new Employee{Name=”Harry”,Age=15},
new Employee{Name=”Peter”,Age=22},
new Employee{Name=”John”,Age=45},
new Employee{Name=”Harry”,Age=15},
new Employee{Name=”Peter”,Age=22},
new Employee{Name=”John”,Age=45},

};

It is required to filter out employees having distinct names.
Which one of the following options cannot be used?

Answers:

  1. public class Employee { public int Age { get; set; } public string Name { get; set; } public override bool Equals(object obj) { return this.Name.Equals(((Employee)obj).Name); } public override int GetHashCode() { return this.Name.GetHashCode(); } } List<Employee> distinctEmployeesByName = lstEmployees.Distinct().ToList();
  2. public class Employee { public int Age { get; set; } public string Name { get; set; } } public class EmployeeEquityComparable : IEqualityComparer<Employee> { #region IEqualityComparer<Employee> Members public bool Equals(Employee x, Employee y) { return x.Name.Equals(y.Name); } public int GetHashCode(Employee obj) { return obj.Name.GetHashCode(); } #endregion } List<Employee> distinctEmployeesByName = lstEmployees.Distinct(new EmployeeEquityComparable()).ToList();
  3. public class Employee:IEqualityComparer<Employee> { public int Age { get; set; } public string Name { get; set; } #region IEqualityComparer<Employee> Members public bool Equals(Employee x, Employee y) { return x.Name.Equals(y.Name); } public int GetHashCode(Employee obj) { return obj.Name.GetHashCode(); } #endregion } List<Employee> distinctEmployeesByName = lstEmployees.Distinct().ToList();
  4. public class Employee { public int Age { get; set; } public string Name { get; set; } } List<Employee> distinctEmployeesByName = (from emp in lstEmployees group emp by emp.Name into gemp select gemp.First()).ToList();

16. What are the benefits of using the ExpandoObject class over a using dictionary?

Answers:

  1. It offers easier data binding from XAML.
  2. It’s interoperable with dynamic languages, which will be expecting DLR properties rather than dictionary entries.
  3. WPF data binding will understand dynamic properties, so WPF controls can bind to an ExpandoObject more readily than a dictionary.
  4. ExpandoObject can help in creating complex hierarchical objects. ExpandoObject implements the INotifyPropertyChanged interface, which gives more control over properties than a dictionary.

17. What will be the output of the following Main program in a C# console application (Assume required namespaces are included):

static void Main(string[] args)
{
int @int = 15;
Console.WriteLine(@int);
Console.ReadLine();
}

Answers:

  1. 15
  2. It will throw a compilation error.
  3. It will throw an error at runtime.
  4. @15

18. What is the purpose of the catch block in the following code?

try {
// Code that might throw exceptions of different types
}

catch {
// Code goes here
}

Answers:

  1. Only errors of type std::unexpected are caught here.
  2. Other code exceptions are caught.
  3. This catch block must be the first one in a series of catch blocks that may or may not be followed.
  4. This catch block can be the last one in a series of catch blocks to handle any exception which is not handled by the preceding catch blocks, each of which handles an exception of a particular type.
  5. No errors are caught in this try block (they are all passed to the next closest catch).
  6. None of these.

19. Which of the following is true about friend functions in C#?

Answers:

  1. Friend functions violate the concept of OOPS.
  2. Friend functions should not be used.
  3. Friend functions enhance the concept of OOPS if used properly.
  4. Friend functions are not available in C#.

20. Which of the following statements is true about the code below?

string[] lines = theText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

Answers:

  1. It splits the string variable on a system line break.
  2. It splits the string variable on a ‘rn’ line break.
  3. It splits the string variable on a system line break, while preserving the empty lines.
  4. It splits the string variable on a system line break, while removing the empty lines.

21. Consider the following code:

string s1 = “Old Value”;
string s2 = s1;
s1 = “New Value”;
Console.WriteLine(s2);

What will be the output printed, and why?

Answers:

  1. “New Value”, because string is a reference type.
  2. “Old Value”, because string is a value type.
  3. “New Value”, because string is a value type.
  4. “Old Value”, because string is a reference type.
  5. “Old Value”, because string is a reference type which is treated as a special case by the assignment operator.

22. What will be the output if in a WinForms application, the following code is executed in the Load event of a form? Assume this form has lblMessage as a Label Control.

private void Form1_Load(object sender, EventArgs e)
{
try
{
ThreadPool.QueueUserWorkItem(ShowMessage,null);
}
catch (Exception ex)
{
}
}

private void ShowMessage(object obj)
{
try
{
lblMessage.Text = “Hello from Thread Pool”;
}
catch (Exception ex)
{
}
}

Answers:

  1. lblMessage.Text will be set to “Hello from Thread Pool”.
  2. An InvalidOperationException will be thrown for the function ShowMessage as the UI can be updated only from the UI thread.
  3. Behavior will vary depending on the form loaded.
  4. None of these.

23. What are Satellite assemblies in C# .NET?

Answers:

  1. Additional assemblies that are used only by the main C# application
  2. User control assemblies used by the C# application
  3. Assemblies that contain only resource information and no code
  4. Assemblies that contain only code and no resource information

24. Where does a C# assembly store the information regarding the other external dependencies, such as satellite assemblies, global assemblies etc, and their versions so that they can be loaded correctly when the assembly is executed?

Answers:

  1. In the embedded resources of the assembly
  2. In the manifest of the assembly
  3. In the MSIL of the assembly
  4. In the Windows registry database
  5. None of these

25. Which of the following will output the string below?
“ttttt”

Answers:

  1. private string Tabs(uint numTabs) { IEnumerable<string> tabs = Enumerable.Repeat(“t”, numTabs); return (numTabs > 0) ? tabs.Aggregate((sum, next) => sum + next) : “”; }
  2. private string Tabs(uint numTabs) { StringBuilder sb = new StringBuilder(); for (uint i = 0; i <= numTabs; i++) { sb.Append(“t”); } return sb.ToString(); }
  3. private string Tabs(uint numTabs) { string output = “”; for (uint i = 0; i <= numTabs; i++) { output += ‘t’; } return output; }
  4. private string Tabs(uint numTabs) { String output = new String(‘t’, numTabs); return output; }

26. Complete the following sentence:

In C#, exception handling should be used…

Answers:

  1. to handle the occurrence of unusual or unanticipated program events
  2. to redirect the programs normal flow of control
  3. in cases of potential logic or user input errors
  4. in case of overflow of an array boundary

27. The global assembly cache:

Answers:

  1. Can store two DLL files with the same name
  2. Can store two DLL files with the same name, but different versions
  3. Can store two DLL files with the same name and same version
  4. Cannot store DLL files with the same name

28. Which statements will give the path where the executing assembly is currently located?

Answers:

  1. System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
  2. System.Reflection.Assembly.GetExecutingAssembly().Location;
  3. AppDomain.CurrentDomain.BaseDirectory;
  4. None of these

29. In C#, can global functions that are not associated with a particular class be defined?

Answers:

  1. Yes
  2. Yes, but they have to be marked with the keyword static.
  3. Yes, but they have to be marked with the keyword internal.
  4. No

30. Which of the following code snippets will call a generic method when the type parameter is not known at compile time?

Answers:

  1. var name = InvokeMemberName.Create; Impromptu.InvokeMemberAction(this, name(“GenericMethod”, new[]{myType}));
  2. MethodInfo method = typeof(Sample).GetMethod(“GenericMethod”); MethodInfo generic = method.MakeGenericMethod(myType); generic.Invoke(this, null);
  3. Action<> GenMethod = GenericMethod< myType >; MethodInfo method = this.GetType().GetMethod(GenMethod.Method.Name); MethodInfo generic = method.MakeGenericMethod(myType); generic.Invoke(this, null);
  4. Action<> GenMethod = GenericMethod< myType >; MethodInfo method = this.GetType().GetMethod(“GenericMethod”); MethodInfo generic = method.MakeGenericMethod(myType); generic.Invoke(this, null);

31. Which of the following is true for CLR?

Answers:

  1. It is an interoperation between managed code, COM objects, and pre-existing DLL’s (unmanaged code and data).
  2. It is a software Output Unit of Deployment and a unit of versioning that contains MSIL code.
  3. It is the primary building block of a .NET Framework application and a collection of functionality that is built, versioned, and deployed as a single implementation unit.
  4. All of these.

32. In the sample code given below, which of the data members are accessible from class Y?

class X {
private int i;
protected float f;
public char c;
}

class Y : X { }

Answers:

  1. c
  2. f
  3. i
  4. All of these

33. If i == 0, why is (i += i++) == 0 in C#?

Answers:

  1. //source code i += i++; //abstract syntax tree += / i i (post) ++
  2. // source code i += i++; //abstract syntax tree += / i ++ (post) i First, i++ returns 0. Then i is incremented by 1. Lastly i is set to the initial value of i which is 0 plus the value i++ returned, which is zero too. 0 + 0 = 0.
  3. int i = 0; i = i + i; i + 1;
  4. int ++(ref int i) { int c = i; i = i + i; return c;}

34. Performance-wise, which of the following is the most efficient way to calculate the sum of integers stored in an object array?

Answers:

  1. int FindSum(object[] values) { int sum = 0; foreach (object o in values) { if (o is int) { int x = (int) o; sum += x; } } return sum; }
  2. int FindSum (object[] values) { int sum = 0; foreach (object o in values) { int? x = o as int?; if (x.HasValue) { sum += x.Value; } } return sum; }
  3. int FindSum (object[] values) { int sum = values.OfType<int>().Sum(); return sum; }
  4. int FindSum (object[] values) { int sum = 0; foreach (object o in values) { if (o is int) { int x = Convert.ToInt32(o); sum += x; } } return sum; }

35. Consider the following code block:

public class Person
{
public string GetAge()
{
lock (this)
{
// Code to get Age of this person object.
}
}
}

Which of the following statements is true?

Answers:

  1. lock(this) actually modifies the object passed as a parameter, and in some way makes it read-only or inaccessible.
  2. lock(this) can be problematic if the instance can be accessed publicly, because code beyond one’s control may lock on the object as well. This could create deadlock situations where two or more threads wait for the release of the same object.
  3. lock(this) marks current object as a critical section by obtaining the mutual-exclusion lock for a given object, all private fields of the object become read-only.
  4. Implement locking using current application instance or some private variable is absolutely the same and does not produce any synchronization issue, either technique can be used interchangeably.

36. The ___________ namespace is not defined in the .NET class library.

Answers:

  1. System
  2. System.CodeDom
  3. System.IO
  4. System.Thread
  5. System.Text

37. Which of the following is true about constructors and member functions?

Answers:

  1. A constructor can return values, but a member function cannot.
  2. A member function can declare and define values, but a constructor cannot.
  3. A member function can return values, but a constructor cannot.
  4. All of these.

38. Which of the following language code is not ‘managed’ by default in .NET framework?

Answers:

  1. Visual Basic
  2. C#
  3. C++
  4. Jscript

39. There is a class that has a public int counter field that is accessed by multiple threads. This int is only incremented or decremented. To increment this field, three thread-safe approaches are mentioned below:

A) lock(this.locker) this.counter++;
B) Interlocked.Increment(ref this.counter);
C) Change the access modifier of counter to public volatile

Which statement is incorrect with regards to these approaches?

Answers:

  1. All 3 are equivalent and can be used interchangeably.
  2. Though A is safe to do, it prevents any other threads from executing any other code which is guarded by locker.
  3. B is the best approach as it effectively does the read, increment, and write in ‘one hit’ which can’t be interrupted.
  4. C on it’s own isn’t actually safe at all. The point of volatile is that multiple threads running on multiple CPU’s can, and will, cache data and re-order instructions.

40. What will happen if the following code is compiled in .NET 4 or above (Assume required namespaces are included)?

public class var { }
public class main
{
public static void main(string[] args)
{
var testVar = new var();
}
}

Answers:

  1. This code will not compile, as var is a reserved keyword, so it can not be used as a class name.
  2. This code will compile, as var is merely a contextual keyword and it is used to provide a specific meaning in the code, so it will cause no problems.
  3. This code will not compile, as a new object cannot be created like var testVar = new var();
  4. None of these.

41. Which object oriented term is related to protecting data from access by unauthorized functions?

Answers:

  1. Inheritance
  2. Data hiding
  3. Polymorphism
  4. Operator overloading
  5. Abstraction

42. One of the ternary operators provided in C# is:

Answers:

  1. *
  2. ::
  3. &
  4. ?:
  5. &lt&lt

43. What type of code is written to avail the services provided by Common Language Runtime?

Answers:

  1. MSIL
  2. Unmanaged code
  3. Managed Code
  4. C#/VB/JS

44. Asynchronous execution is supported in ADO.NET 2.0 for?

Answers:

  1. ExecuteReader
  2. ExecuteScalar
  3. ExecuteNonQuery
  4. All of these

45. The .NET Framework consists of:

Answers:

  1. The Common Language Runtime
  2. A set of class libraries
  3. The Common Language Runtime and a set of class libraries

46. An enum is defined in a program as follows:
[Flags]
public enum Permissions
{
None = 0,
Read = 1,
Write = 2,
Delete = 4
}

What will be the output of the following Main program (which has access to the enum defined above) in this C# console application (Assume required namespaces are included) :

static void Main(string[] args)
{
var permissions = Permissions.Read | Permissions.Write;
if ((permissions & Permissions.Write) == Permissions.Write)
{
Console.WriteLine(“Write”);
}
if ((permissions & Permissions.Delete) == Permissions.Delete)
{
Console.WriteLine(“Delete”);
}
if ((permissions & Permissions.Read) == Permissions.Read)
{
Console.WriteLine(“Read”);
}
Console.ReadLine();
}

Answers:

  1. Write Delete Read
  2. Write Delete
  3. Delete
  4. Write Read

47. Which of the following keywords prevents a class from being overridden further?

Answers:

  1. abstract
  2. sealed
  3. final
    oot
  4. internal

48. Suppose a class is declared as a protected internal:
protected internal class A
{
}

Which statement is correct with regards to its accessibility?

Answers:

  1. This class can be accessed by code in the same assembly, or by any derived class in another assembly.
  2. This class can only be accessed by code which is in the same assembly.
  3. This class can only be accessed by code which is in the derived class (i.e. classes derived from Class A) and which are in the same assembly.
  4. This class can be accessed by any code whether in the same assembly or not.

49. Which of the following is the correct way to randomize a generic list of 75 numbers using C#?

Answers:

  1. Random random = new Random(); List<object> products= GetProducts(); products.OrderBy(product => random.Next(products.Count));
  2. Random random = new Random(); List<object> products= GetProducts(); products.Randomize(product => random.Next(products.Count));
  3. Random random = new Random(); List<object> products= GetProducts(); products.Randomize(products.Count);
  4. Random random = new Random(); List<object> products= GetProducts(); products.Reverse(product => random.Next(products.Count));

50. What will be the value of the result variable after these two statements?

int num1 = 10, num2 = 9;

int result = num1 & num2;

Answers:

  1. 1
  2. 8
  3. 9
  4. 10
  5. 11
  6. 109

51. What is the output of the following code:

class CCheck {

public static void Main() {
string str = @”E:\RIL\test.cs”;
Console.WriteLine(str);
}
}

Answers:

  1. “E:\RIL\test.cs”
  2. E:\RIL\test.cs
  3. “E:RILtest.cs”
  4. The compiler will generate an error saying undefined symbol ‘@’.

52. What is the issue with the following function?

public string GetName(int iValue)
{
string sValue = “0”;
switch (iValue)
{
case 1:
sValue = iValue.ToString();
case 2:
sValue = iValue.ToString();
break;
default:
sValue = “-1”;
break;
}
return sValue;
}

Answers:

  1. The code will not compile as there shouldn’t be a break statement in the default case label.
  2. The code will compile but if case 1 is passed as the input parameter to the function, the code for case 2 will also execute (after the code for case 1), and so the wrong value may be returned.
  3. The code will compile and run without any issues.
  4. The code will not compile as there is no break statement in case 1.

53. What will be the output of the following Main program in a C# console application (Assume required namespaces are included):

static void Main(string[] args)
{
for (int i = 0; i < 1; i++)
{
Console.WriteLine(“No Error”);
}
int A = i;
Console.ReadLine();
}

Answers:

  1. No Error
  2. This program will throw a compilation error, “The name ‘i’ does not exist in the current context”.
  3. The program will compile, but throw an error at runtime.
  4. None of these.

54. What is the difference between int and System.Int32 CLR types?

Answers:

  1. int represents a 16-bit integer while System.Int32 represents a 32-bit integer.
  2. int is just an alias for System.Int32, there is no difference between them.
  3. int represents a 64-bit integer while Int32 represents a 32-bit integer.
  4. None of these.

55. What will be the return value if the function fn is called with a value of 50 for the parameter var?

public int fn(int var)
{
int retvar = var – (var / 10 * 5);
return retvar;
}

Answers:

  1. 50
  2. 25
  3. 49
  4. Error message
  5. None of these

56. Which of the following code snippets converts an IEnumerable<string> into a string containing comma separated values?

Answers:

  1. public static string ConvertToString(IEnumerable<T> source) { return new List<T>(source).ToArray(); }
  2. public static string ConvertToString(IEnumerable<T> source) { return string.Join(“,”,source.ToArray()); }
  3. public static string ConvertToString(IEnumerable<T> source) { return source.ToString(); }
  4. public static string ConvertToString(IEnumerable<T> source) { return string.Join(source.ToArray()); }

57. Which of the following is true regarding a null and an empty collection in C#?

Answers:

  1. An empty collection and a null are both objects.
  2. An empty collection and a null both have the same meaning.
  3. Both an empty collection and a null do not refer to any object.
  4. An empty collection is an object while the null keyword is a literal.

58. Which of the following exceptions cannot be thrown by the Delete() function of the FileInfo class (ie. FileInfo.Delete())?

Answers:

  1. IOException
  2. SecurityException
  3. UnauthorizedAccessException
  4. InvalidOperationException

59. Which of the following statements are true regarding the ref and out parameters in C#?

Answers:

  1. A variable that is passed as an out parameter needs to be initialized, but the method using the out parameter does not need to set it to something.
  2. The out parameter can be used to return the values in the same variable passed as a parameter of the method. Any changes made to the parameter will be reflected in the variable.
  3. The ref keyword can only be used on one method parameter.
  4. The ref parameter is considered initially assigned by the callee. As such, the callee is not required to assign to the ref parameter before use. Ref parameters are passed both into and out of a method.

60. What is the difference between the String and StringBuilder class objects with respect to mutability?

Answers:

  1. String objects are mutable, while StringBuilder objects are immutable.
  2. String objects are immutable, while StringBuilder objects are mutable.
  3. There is no difference between them in this context, as both are immutable.
  4. There is no difference between them in this context, as both are mutable.

61. Which of the following code samples will create a comma separated list from IList<string> or IEnumerable<string>?

Answers:

  1. public static T[] ToArray(IEnumerable<T> source) { return new List<T>(source).ToArray(); } IEnumerable<string> strings = …; string[] array = Helpers.ToArray(strings); string joined = string.Join(“,”, strings.ToArray()); string joined = string.Join(“,”, new List<string>(strings).ToArray());
  2. List<string> ls = new List<string>(); ls.Add(“one”); ls.Add(“two”); string type = string.Join(“,”, ls.ToArray());
  3. string commaSeparatedList = input.Aggregate((a, x) => a + “, ” + x)
  4. public static string Join(this IEnumerable<string> source, string separator) { return string.Join(separator, source); }

62. What is the advantage of using IList<T> over List<T>?

Answers:

  1. IList<T> uses reflection, which is the most efficient way to process an object inside memory.
  2. IList<T> implements hashing to store objects in the collection; which produces optimum performance.
  3. Using IList<T> rather than List<T> allows the code to be more flexible. It can replace the implementation with any collection that implements IList<T> without breaking any calling code.
  4. IList<T> only allows immutable types to be stored inside the collection.

63. How can a single instance application be created in C#?

Answers:

  1. System.Threading.SingleInstance can be used to ensure that only one instance of a program can run at a time.
  2. System.Threading.Mutex can be used to ensure that only one instance of a program can run at a time.
  3. Locks can be used to force a C# application to launch a single instance at a time.
  4. C# applications cannot be restricted to a single instance.

64. Which of the following code samples will execute a command-line program in C# and return its STD OUT results?

Answers:

  1. System.Diagnostics.Process pProcess = new System.Diagnostics.Process(); pProcess.StartInfo.FileName = strCommand; pProcess.StartInfo.Arguments = strCommandParameters; pProcess.StartInfo.UseShellExecute = false; pProcess.StartInfo.RedirectStandardOutput = true; pProcess.Start(); string strOutput = pProcess.StandardOutput.ReadToEnd(); pProcess.WaitForExit();
  2. Process p = new Process(); p.StartInfo.UseShellExecute = true p.StartInfo.RedirectStandardOutput = false p.StartInfo.FileName = “YOURBATCHFILE.bat”; p.Start(); string output = p.StandardOutput.ReadToEnd(); p.WaitForExit();
  3. System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(“program_to_call.exe”); psi.RedirectStandardOutput = true; psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; psi.UseShellExecute = false; System.Diagnostics.Process proc System.Diagnostics.Process.Start(psi);; System.IO.StreamReader myOutput = proc.StandardOutput; proc.WaitForExit(2000); if (proc.HasExited) { string output = myOutput.ReadToEnd(); }
  4. System.Diagnostics.Process pProcess = new System.Diagnostics.Process(); pProcess.StartInfo.FileName = strCommand; pProcess.StartInfo.Arguments = strCommandParameters; pProcess.StartInfo.UseShellExecute = false; pProcess.StartInfo.RedirectStandardOutput = true; pProcess.StartInfo.WorkingDirectory = strWorkingDirectory; pProcess.Start(); string strOutput = pProcess.StandardOutput.ReadToEnd(); pProcess.WaitForExit();

65. What is an Action delegate?

Answers:

  1. An Action is a delegate to a method, that takes zero, one or more input parameters, but does not return anything.
  2. An Action is a delegate to a method, that takes zero, one or more input parameters, but always returns a boolean value.
  3. An Action is a delegate to a method that takes one or more input parameters, but does not return anything.
  4. An Action is a delegate to a method that takes one or more input parameters, but always returns a boolean value.

66. What is the difference between Expression<Func<T>> and Func<T>?

Answers:

  1. There is no difference between the two.
  2. Func<T> denotes a delegate, while Expression<Func<T>> denotes a tree data structure for a lambda expression.
  3. Func<T> denotes a function with parameter of dynamic type, while Expression<Func<T>> denotes a lambda expression.
  4. None of these.

67. Which of the following statements is true about IEnumerable<T>?

Answers:

  1. IEnumerable<T> supports a Size property.
  2. IEnumerable<T> supports a Count() extension.
  3. IEnumerable<T> cannot be casted onto an ICollection<T>.
  4. IEnumerable<T> cannot be casted onto an IList<T>.

68. Which of the following statements is true about the System.Environment.NewLine property?

Answers:

  1. It’s a string containing “n” for non-Unix platforms.
  2. It’s a string containing “n” for Unix platforms.
  3. It’s a string containing “rn” for non-Unix platforms.
  4. It’s a string containing “rn” for Unix platforms.

69. An Interface represents which kind of relationship?

Answers:

  1. IS A
  2. HAS A
  3. CAN DO
  4. None of these

70. Why is it a bad practice to use iteration variables in lambda expressions?

Answers:

  1. Iteration variables can cause problems with accessing a modified closure.
  2. Iteration variables are passed by value, which produces unexpected results.
  3. Iteration variables are passed by reference, which produces unexpected results.
  4. It is perfectly valid to use iteration variables in lambda expressions.

71. Which of the following code samples will check if a file is in use?

Answers:

  1. protected virtual bool IsFileLocked(FileInfo file) { FileStream stream = null; try { stream = file.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None); } catch (IOException) { return true; } finally { if (stream != null) stream.Close(); } return false; }
  2. try { using (Stream stream = new FileStream(“MyFilename.txt”, FileMode.Open)) { } } catch { }
  3. internal static bool FileOrDirectoryExists(string name) { return (Directory.Exists(name) || File.Exists(name)) }
  4. FileInfo file = new FileInfo(“file.txt”); if (file.Exists) { // TO DO }

72. Which of the following statements is true regarding the code samples below?

A:
try {
// code goes here
} catch (Exception e) {
throw e;
}

B:
try {
// code goes here
} catch (Exception e) {
throw;
}

Answers:

  1. A will lose the call stack trace information. B will preserve the call stack trace information.
  2. A will preserve the call stack trace information. B will lose the call stack trace information.
  3. Both A and B will preserve the call stack trace information.
  4. Both A and B will lose the call stack trace information.

73. Which of the following is the correct way to implement deep copying of an object in C#?

Answers:

  1. By using the System.Runtime.Serialization.Formatters.Binary.BinaryFormatter class.
  2. By using the System.Reflection.DeepCopy class.
  3. By using the DeepCopy() method of Object class.
  4. By using the MemberwiseClone() method of Object class.

74. What will be the output of the following Main program in a C# console application (Assume required namespaces are included)?

static void Main(string[] args)
{
string Invalid = “$am$it$”;
string sResult = Invalid.Trim(new char[]{‘$’});
Console.WriteLine(sResult);
Console.ReadLine();
}

Answers:

  1. amit
  2. am@am$
  3. $am$it$
  4. am$it

75. Which of the following is the correct way to perform a LINQ query on a DataTable object?

Answers:

  1. var results = from myRow in myDataTable where results.Field(“RowNo”) == 1 select results;
  2. var results = from myRow in myDataTable.AsEnumerable() where myRow.Field(“RowNo”) == 1 select myRow;
  3. var results = from myRow in myDataTable.Rows where myRow.Field<int>(“RowNo”) == 1 select myRow;
  4. var results = from myRow in myDataTable.AsEnumerable() where myRow.Field<int>(“RowNo”) == 1 select new { IID= myRow.Field<int>(“IID”), Date = myRow.Field<DateTime>(“Date”), };

76. What is the purpose of the vshost.exe file in Visual Studio?

Answers:

  1. It is used to improve the performance of the Visual Studio debugger.
  2. It is used to improve the performance of Visual Studio plugins.
  3. It is used to improve the performance of the C# compiler.
  4. It is used to load Visual Studio configuration data.

77. Which of the following code snippets for catch shows a better way of handling an exception?

1.
catch (Exception exc)
{
throw exc;
}
2.
catch (Exception exc)
{
throw;
}

Answers:

  1. 1 is better as it maintains the call stack.
  2. 2 is better as it maintains the call stack.
  3. Both are same.
  4. None of these.

78. What will be the value of result after these two statements?

int num1 = 10, num2 = 9;
int result = num1 ^ num2;

Answers:

  1. 1
  2. 8
  3. 9
  4. 10
  5. 3
  6. 1000000000
  7. 109

79. What will be the output of the following Main program in a C# console application (Assume required namespaces are included)?
static void Main(string[] args)
{
string sPrint = String.Format(“{{ My name is bond. }}”);
Console.WriteLine(sPrint);
Console.ReadLine();
}

Answers:

  1. {{ My name is bond. }}
  2. It will throw a compilation error.
  3. { My name is bond. }
  4. It will throw a runtime error.

80. What is the difference between data types “System.String” and “string” in C#?

Answers:

  1. string is a value type, while System.String is a reference type.
  2. There is no difference,string is just an alias of the System.String data type.
  3. string variable is limited to storing alphabetic characters, while System.String does not have any limit.
  4. None of these.

81. Which of the following is the correct code to close all references to the com objects below?

Workbooks books = excel.WorkBooks;
Workbook book = books[1];
Sheets sheets = book.WorkSheets;
Worksheet ws = sheets[1];

Answers:

  1. Marshal.ReleaseComObject(books);
  2. Marshal.FinalReleaseComObject(books);
  3. Marshal.ReleaseComObject(sheets); Marshal.ReleaseComObject(books);
  4. Marshal.ReleaseComObject(sheet); Marshal.ReleaseComObject(sheets); Marshal.ReleaseComObject(book); Marshal.ReleaseComObject(books);

82. Which of the following is the correct way to sort a C# dictionary by value?

Answers:

  1. List<KeyValuePair<string, string>> myList = aDictionary.ToList(); myList.Sort( delegate(KeyValuePair<string, string> firstPair, KeyValuePair<string, string> nextPair) { return firstPair.Value.CompareTo(nextPair.Value); } );
  2. List<KeyValuePair<string, string>> myList = aDictionary.ToList(); myList.Sort((firstPair,nextPair) => { return firstPair.Value.CompareTo(nextPair.Value); } );
  3. foreach (KeyValuePair<string,int> item in keywordCounts.OrderBy(key=> key.Value)) { // do something with item.Key and item.Value }
  4. var ordered = dict.OrderBy(x => x.Value);

5,967 total views, 14 views today