What is a semaphore? 

1 Answer

Answer :

A resource management, synchronization, and locking tool. 

Related questions

Description : There are three processes P1, P2 and P3 sharing a semaphore for synchronising a variable. Initial value of semaphore is one. Assume that negative value of semaphore tells us how many processes are waiting in queue. Processes access ... The final value of semaphore will be: (1) 0 (2) 1 (3) -1 (4) -2 

Last Answer : Answer: 1

Description : State the methods of task synchronization. Describe semaphore with suitable example.

Last Answer : The methods of task synchronization are: Semaphore Message queue. Mutual exclusion.  Dead lock. Mailboxes. Message Queues. Semaphores: It is a system of sending message by using flags. Multiple concurrent threads of execution ...   signal(Sem);  }  in process P2  {  wait(Sem);  S2;  }

Last Answer : A semaphore is called binary semaphore when its value is 0, it is assumed that it has been taken (or accepted) & when its value is 1, it is assumed that it has been released & no ... that are not themselves reentrant.3. A reentrant function may does not use the hardware in a nonatomic way.

Description : What are counting semaphores and resource semaphore?

Last Answer : If a task tries to take the semaphore when the integer is equal to zero, then the task will block. These semaphores are called counting semaphore. Some system offer semaphore that can be ... , but they cannot be used to communicate between two tasks. Such semaphores are called resource semaphore.

Description : What si the difference between interface and abstractclass Select Answer:  1. interface contain only methods  2. we can't declare a variable for interface  3. interface contain only events  4. None  5. All

Last Answer : Ans : 2 The only Difference between Interface and Abstract class is we can declare a variable in abstract class but we can't declare in variable interface

Description : What is the lifespan for items stored in ViewState? Select Answer:  1. Item stored in ViewState exist for the life of the current page  2. Item stored in ViewState exist for the life ... of the current Applicaiton  4. Item stored in ViewState exist for the life of the current configuration

Last Answer : 1. Item stored in ViewState exist for the life of the current page AS any web application works on request and response basis ,so on every post backs, The data in control gets lost. To retain page ... control with data. The life cycle of the view state exist for life of current running page only. 

Description : Which one of the following tools is used to view the metadata information contained in a .NET assembly? Select Answer:  1. al.exe  2. ilasm.exe  3. vbx.exe  4. csc.exe  5. ildasm.exe

Last Answer :  5. ildasm.exe

Description : How would you ensure that all relevant registry entries were removed in the event that installation of your application failed?

Last Answer : You can ensure that registry entries are removed, as well as perform any other “clean-up” tasks, by creating an Installer class and writing the appropriate code in the Rollback event handler. Then create a new Custom Action and set the InstallerClass, and EntryPoint properties to appropriate values.

Description : Describe a general strategy for creating a setup project that terminates installation if a specific file is not already installed on the target machine.

Last Answer : First, create a file search to search the file system for the specific file. Then create a launch condition to evaluate the results of the search. You can connect the launch condition to ... in the search's Property property in the expression specified by the launch condition's Condition property. 

Description : What is the purpose of a bootstrapper application? When do you not need to create one?

Last Answer : A bootstrapper application automatically detects if Windows Installer is installed on the target machine. If Windows Installer is not present, it installs Windows Installer before proceeding with the rest ... Installer 1.5 already installed) or have had Microsoft Installer 1.5 installed previously.

Description : What is a native image? How do you create one?

Last Answer : A native image is a precompiled version of a .NET assembly. You can create a native image of your application by using the Ngen.exe utility.

Description : Describe XCOPY deployment. Under what conditions is it useful? When can it not be used?

Last Answer : XCOPY deployment is a simple method of deployment where the DOS command XCOPY is used to copy the application directory and any subdirectories to the target machine. You can use XCOPY ... an application requires a more complex deployment or references shared assemblies, you cannot use XCOPY.

Description : What is a shared assembly? How would you create one?

Last Answer : An assembly is an assembly of which only a single copy is installed per machine. This copy can be shared by multiple applications. To make an assembly a shared assembly, you must first assign it a strong name, and then install it to the global assembly cache.

Description : Briefly highlight the differences between imperative and declarative security as they pertain to code access security.

Last Answer : Imperative security is implemented by calling methods of Permission objects in code at run time. Declarative security is configured by attaching attributes representing permissions to classes ... request assembly-wide permissions using the Assembly (assembly) directive with declarative security.

Description : Explain how to retrieve information from the configuration file at run time. How would you store information in the configuration file at design time?

Last Answer : You must first create an instance of AppSettingsReader to read the configuration file. You can then call the GetValue method to read values represented in the configuration file. To add configuration ... used to retrieve the entry. The value can be changed between executions of the application.

Description : Describe how to use code to retrieve resources at run time.

Last Answer : You must first create an instance of the ResourceManager class that is associated with the assembly that contains the desired resource. You can then use the GetString method to retrieve string resources or the GetObject method to retrieve object resources.

Description : Describe how to sign your assembly with a strong name. Why would you want to do this?

Last Answer : To sign your assembly with a strong name, you must have access to a key file or create one with the strong name utility (sn.exe). You then specify the key file in the AssemblyInfo file and ... identity, a strong name is required if you want to install your assembly to the Global Assembly Cache.

Description : Explain how to use the PrintPreviewDialog control to display a preview of a printed document before it is printed.

Last Answer : You display a preview of a printed document with the PrintPreviewDialog control by first setting the PrintDocument property of the PrintPreviewDialog instance to the PrintDocument you want to preview, then by calling the PrintPreviewDialog.Show command to display the dialog box. 

Description : Explain the difference between Globalization and Localization.

Last Answer : Globalization refers to the application of culture-specific format to existing data. Localization refers to providing new culture-specific resources and retrieving the appropriate resources based on the culture setting. 

Description : Explain how to convert data in legacy code page formats to the Unicode format.

Last Answer : You can use the Encoding.Convert method to convert data between encoding types. This method requires instances of both encoding types and an array of bytes that represents the data to be converted. ... GetBytes method and can convert an array of bytes back to chars with the Encoding.GetChars method.

Description : Describe how to create localized versions of a form.

Last Answer : To create a localized version of a form, set the Localizable property to true. Then set the Language property to the language/region for which you want to create the localized form. Make ... be stored in resource files and loaded when the CurrentUICulture is set to the appropriate CultureInfo. 

Description : Explain how to use the HelpProvider component to provide help for UI elements.

Last Answer : You can provide either a HelpString or a help topic for UI elements with the HelpProvider. The HelpProvider provides HelpString, HelpKeyWord, and HelpNavigator properties for each control on the form. If ... particular element is displayed when the element has the focus and the F1 key is pressed.

Description : Briefly describe the five accessibility requirements of the Certified for Windows logo program.

Last Answer : The five requirements are o Support standard system settings. This requires your application to be able to conform to system settings for colors, fonts, and other UI elements. o Be ... information by sound alone. This requirement can be met by providing redundant means of conveying information.

Description : Explain how to use the Begin and End methods on a Web Service to make an asynchronous method call.

Last Answer : Every public Web method on a Web Service can be called either synchronously or asynchronously. To make an asynchronous call to a Web method, you call the method named Begin, where is the name of ... returned by Begin. This will allow you to retrieve the actual data returned by the Web method.

Description : Briefly describe how to use the PrintDocument component to print a document. Discuss maintaining correct line spacing and multipage documents.

Last Answer : The PrintDocument class exposes the Print method, which raises the PrintPage event. Code to render printed items to the printer should be placed in the PrintPage event handler. The PrintPage event ... been printed, you must incorporate all logic for printing multiple pages into your event handler.

Description : Describe how to create a form or control with a nonrectangular shape.

Last Answer : Set the Region property of the form or control to a Region object that contains the irregular shape. You can create a Region object from a GraphicsPath object.

Description : Describe the role of the LicenseProvider in control licensing.

Last Answer : The LicenseProvider controls license validation and grants run-time licenses to validly licensed components. The LicenseManager.Validate method checks for an available license file and checks ... of LicenseProvider. You specify which LicenseProvider to use by applying the LicenseProviderAttribute. 

Description : Describe the general procedure for rendering text to a drawing surface.

Last Answer : You must first obtain a reference to a Graphics object. Next, create an instance of a GraphicsPath object. Use the GraphicsPath.AddString method to add text to the GraphicsPath. Then, call the Graphics.DrawPath or Graphics.FillPath to render the text.

Description : Describe the roles of Graphics, Brush, Pen, and GraphicsPath objects in graphics rendering.

Last Answer : The Graphics object represents a drawing surface and encapsulates methods that allow graphics to be rendered to that surface. A Brush is an object that is used to fill solid shapes, and a Pen ... lines. A GraphicsPath object represents a complex shape that can be rendered by a Graphics object.

Description : Briefly describe the three types of user-developed controls and how they differ.

Last Answer : The three types of user-developed controls are inherited controls, user controls, and custom controls. An inherited control derives from a standard Windows Forms control and inherits the ... inherit only generic control functionality. All specific functionality must be implemented by the developer.

Description : What is meant by a SQL injection attack? How can you prevent them from occurring in your application? 

Last Answer : SQL injection attacks occur when a malicious user attempts to execute SQL code by passing a SQL string to the application through user input. You can guard against SQL injection attacks by validating the format of all strings derived from user input that are used to form ad hoc SQL statements.

Description : In Visual Basic .NET or Visual C# programming, when would you use Structured Query Language (SQL)? How are they executed? 

Last Answer : ADO.NET handles most of the database communication for you behind-thescenes. You would only use SQL statements when generating ad-hoc queries for the database. You execute SQL statements by ... returning statements, such as DELETE, INSERT INTO, or UPDATE statements, use the ExecuteNonQuery method.

Description : What are the four major parts of a SQL SELECT statement? Briefly describe each one.

Last Answer : The four major parts of a SELECT statement are SELECT, FROM, WHERE, and ORDER BY. SELECT specifies the fields to be retrieved. FROM specifies the table from which the records are to be retrieved. WHERE ... the records to be retrieved, and ORDER BY allows you to specify a sort order for the records.

Description : Briefly describe an XmlDataDocument and how it relates to a DataSet.

Last Answer : An XmlDataDocument is an in-memory representation of data in a hierarchical XML format. Each XmlDataDocument is synchronized with a DataSet. Whenever changes are made to one object, the other is instantly updated. Thus, you can use the XmlDataDocument to perform XML manipulations on a DataSet.

Description : Describe how to use a DataView to filter or sort data.

Last Answer : You can apply sort criteria to a DataView by setting the Sort property to the name of a column or columns to be sorted by. The data represented in a DataView object can be filtered by setting the RowFilter property to a valid filter expression.

Description : How can you manage data currency on a form with several bound controls?

Last Answer : Every data source on a form has an associated CurrencyManager object that keeps that of the current record with respect to bound controls. For convenience, all of the CurrencyManager objects ... property. The Position of the CurrencyManager can be changed, allowing navigation through the records. 

Description : Briefly discuss the advantages and disadvantages of using typed DataSet objects.

Last Answer : Typed DataSet objects allow you to work with data that is represented as members of the .NET common type system. This allows your applications to be aware of the types of data returned in a DataSet and serves ... if you do not know the structure of your data, and can be used with any data source. 

Description : How could you execute DDL commands, such as ALTER or CREATE TABLE, against a database with ADO.NET?

Last Answer : You must use a Command object to execute DDL commands. You can set the CommandType property to Text and enter the appropriate DDL command in the CommandText property. Then call Command.ExecuteNonQuery to execute the command.

Description : What are the three possible settings for the CommandType property of a SqlCommand object or an OleDbCommand object, and what does each mean?

Last Answer : A Command object can have a CommandType property setting of Text, StoredProcedure, or TableDirect. When set to Text, the command executes the SQL string that is stored in the Command object's ... that the command should return the entire contents of the table indicated by the CommandText property. 

Description : Briefly contrast connected and disconnected data access in ADO.NET.

Last Answer : In ADO.NET, connected data access is available through the DataReader, which is a lightweight class designed to provide very fast and efficient data access. It is severely limited, however, in ... to update the database and keeping the connection open just long enough to execute those commands.

Description : What are the major components of a Data Provider, and what function does each fulfill?

Last Answer : An ADO.NET Data Provider is a suite of components designed to facilitate data access. Every Data Provider minimally includes a Connection object that provides the actual connection to the data ... only, read-only access to a database, and a DataAdapter that facilitates disconnected data access.

Description : When would you use the Watch window? 

Last Answer : You would use the Watch window to observe the values of application variables while in Break mode.

Description : Describe Break mode and some of the available methods for navigating in Break mode.

Last Answer : Break mode allows you to observe program execution on a line-by-line basis. You can navigate program execution in Break mode by using Step Into, Step Over, Step Out, Run To Cursor, and Set Next Statement.

Description : Describe an abstract class and explain when one might be useful.

Last Answer : An abstract class is a class that cannot be instantiated but must be inherited. It can contain both implemented methods and abstract methods, which must be implemented in an inheriting class. ... common interface for other methods, and leave more detailed implementation up to the inheriting class.

Description : What is method overloading, and when is it useful?

Last Answer : Method overloading allows you to create several methods with the same name but different signatures. Overloading is useful when you want to provide the same or similar functionality to different sets of parameters.

Description : Briefly explain encapsulation and why it is important in object-oriented - programming.

Last Answer : Encapsulation is the principle that all of the data and functionality required by an object be contained by that object. This allows objects to exist as independent, interchangeable units of functionality without maintaining dependencies on other units of code.

Description : What are the two kinds of multidimensional arrays? Briefly describe each.

Last Answer : Multidimensional arrays can be either rectangular arrays or jagged arrays. A rectangular array can be thought of as a table, where each row has the same number of columns. Rectangular arrays with ... dimensional jagged array is like a table where each row might have a different number of columns.

Description : Briefly explain how to convert a string representation of a number to a numeric type, such as an Integer or a Double.

Last Answer : All numeric data types have a Parse method that accepts a string parameter and returns the value represented by that string cast to the appropriate data type. You can use the Parse method of each data type to convert strings to that type.

Description : Explain what a delegate is and how one works. 

Last Answer : A delegate acts like a strongly typed function pointer. Delegates can invoke the methods that they reference without making explicit calls to those methods.

Description : Explain how properties differ from fields. Why would you expose public data through properties instead of fields?

Last Answer : Properties allow validation code to execute when values are accessed or changed. This allows you to impose some measure of control over when and how values are read or changed. Fields cannot perform validation when being read or set.