answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

Write a program to shift a 8-bit number left by two bits?

#include<stdio.h>

#include<conio.h>

void main()

{

int n,i;

clrscr();

printf("Enter the number on which left shift operation is to be performed: ");

scanf("%d",&n);

printf("\nBefore shifting the number was: %d\n",n);

i=n<<2; //LEFT SHIFT OPERATION

printf("After shifting the number is: %d\n",i);

getch();

}

What symbol is used for an assignment statement in a flowchart?

Assignment is usually indicated using Pascal assignment notation (:=). E.g., x := x + 1. This avoids any confusion with the equality operator (=).

How do infix notation and postfix notation differ?

It's simply a matter of where the operators are placed in relation to their operands:

infix: X + Y

prefix: + X Y

postfix: X Y +

All of the above are equivalent.

Prefix notation is also known as Polish notation, hence postfix is also known as reverse Polish notation.

Given the infix equation A * B + C / D, the order of evaluation is always parenthesis, orders, divide/multiply, add/subtract (PODMAS), thus we must multiply A by B first, then divide C by D, and finally add the two results together. If we wish to perform the addition first, then we must re-write the equation with parenthesis: A * (B + C) / D.

With postfix and prefix notation, operator precedence becomes superfluous because we always evaluate these expressions in left-to-right order:

Infix A * B + C / D becomes postfix A B * C D / + or prefix / * A + B C D

Infix A * (B + C) / D becomes postfix A B C + * D / or prefix + * A B / C D

When we eliminate operator precedence with postfix or prefix notation, we greatly simplify the algorithm required to evaluate complex expressions. For example, given the postfix expression A B C + * D /, we simply read the symbols one at a time, placing them on a stack, until we encounter an operator. We then pop the first two elements off the stack, perform the operation, and then pop the result back on the stack. We repeat this process until there are no more symbols left, at which point the stack holds just one value: the result.

With prefix notation, we place the operators on the stack instead of the operands. When we read the first operand we simply store it in an accumulator. We continue pushing operators onto the stack until we encounter the second operand, at which point we can pop the first operator off the stack, perform the operation and update the accumulator. We repeat this process until there are no symbols left, at which point the accumulator holds the final result.

Note that when presented with an infix expression, a machine has to convert the expression to the equivalent prefix or postfix expression before it can be evaluated. By eliminating this conversion process, computation by machine can be performed with much greater speed.

What is directory creation and deletion?

CreateDirectory(String) Creates all directories and subdirectories in the specified path.

CreateDirectory(String, DirectorySecurity) Creates all the directories in the specified path, applying the specified Windows security.

Delete(String) Deletes an empty directory from a specified path.

Delete(String, Boolean) Deletes the specified directory and, if indicated, any subdirectories and files in the directory. public static DirectoryInfo CreateDirectory ( string path )

public static void Delete ( string path, bool recursive )

What is the purpose of the monitor?

What Is the Purpose of a Monitor? By James Walker, eHow Contributor

It doesn't matter how powerful or how fast your computer is. Without a monitor, it is useless. There are many kinds of monitors out there, and they all have very different functions. Knowing what purposes monitors serve in everyday life can go a long way in helping you decide what kind to look for when it's time to replace the one you're reading this on.

  1. Basic FunctionWatching Movies
  2. The basic function of a monitor is, of course, to serve as the visual display to help you navigate your computer. Playing Video Games
  3. Newer monitors are now built with high-definition imaging. Almost all of these monitors are LCD or plasma screen. Secondary Television Screen
  4. Because of the high technical and visual demands of computer gaming, many monitor manufacturers now sell gaming-specific monitors. These are designed to keep up with the frantic action of most computer games. Touch-Screen
  5. Many new high-definition televisions come with basic VGA (Video Graphics Array) adapters built into them. This means that in addition to being a fully functioning high-definition monitor, it can also be used to watch television.
  6. Touch-screen computers are beginning to see a resurgence in popularity, due in no small part to the monitor. Touch-screen monitors allow users to do away with the keyboard and mouse and interact with every object on the screen directly.

Read more: What Is the Purpose of a Monitor? | eHow.com http://www.ehow.com/about_5040911_purpose-monitor.html#ixzz1EENf909k

Lost your personal computer password?

Forgot computer passwords? Have been locked out of computer? Maybe, many people have the same nerve-wracking problem ----- Lost the windows passwords. In fact, there are many solutions to bypass/remove/reset/erase/delete the login passwords .

Method 1: Log into an alternate account

Often many users will leave the administrator account alone and/or have other accounts with administrator rights. If you're not logging into the computer as administrator or have other accounts follow the below steps to reset your other accounts password.

Reboot the computer into Safe Mode. Additional information about getting into Safe

When logging into Safe Mode you should be prompted with an option to what account you wish to use. Select the Administrator account. If prompted for a password try simply pressing Enter on the keyboard for no password. If this does not work, try other passwords you may have used. If you're unable to log into the Administrator account skip to the next suggestion.

Once you've logged into the Administrator account open Control Panel and User Accounts.

In User Accounts select the account you wish to change the password for, click change password and then enter the new password or click remove the password to remove the password from the account.

Method 2: Using the forgotten password diskette

If you have forgotten your Windows XP password, however have created a forgotten password diskette earlier to use the diskette follow the below steps.

1 At the Windows XP login prompt when the password is entered incorrectly click the reset button in the login failed window.

2 Insert the password reset diskette into the computer and click Next.

3 If the correct diskette Windows XP will open a window prompting for the new password you wish to use.

Method 3: Using the Third part utility---Windows Password Unlocker

If you have neither other accounts with administrator rights nor passwords reset diskette, take use of the third part password reset tool. There are many related tools that can help to remove/reset/bypass widows passwords. Here, Windows Password Unlocker is highly recommended. It has been tested on all kinds of Windows Systems, and the performance is always perfect. However, it keep the whole data intact but the login password.

1.Download Windows Password Unlocker from Password Unlocker Official site http://www.passwordunlocker.com/products/wpu.html .

2.Decompress the Windows password unlocker and note that there is an .ISO image file. Burn the image file onto an blank CD with the burner freely supported by Password Unlocker.

3.Insert the newly created CD into the locked computer and re-boot it from the CD drive.

4.After launched the CD, a window pop up with all your account names(if you have several accounts); select one of the accounts that you have forgotten its password to reset it. Just one press, you have removed the password.

What is the Codd rule and how does it relate to RDBMS?

Codd's Rule Maulin Thaker Ahmedabad There are 13 (0 to 12) rules which were presented by Dr. E.F.Codd ,in June 1970,in ACM (Association of Computer Machinery) Rule 0. Relational Database management “A relational database management system must use only its relational capabilities to manage the information stored in the database”. Rule 1. The information rule All information in the database to be represented in one and only one way, Namely by values in column positions within rows of tables. Rule 2. Logical accessibility This rule says about the requirement of primary keys. Every individual value in the database must be logically addressable by specifying the name of table, column and the primary key value of the row. Rule 3. Representation of null values The DBMS is required to support a representation of "missing information and inapplicable information" (for example, 0 'Zero' is different from other Numbers), This type of information must be represented by the DBMS in a systematic way (For example Null Character ). Rule 4. Catalog Facilities The system is required to support an on line, in line, relational data access to authorized users by using their Query language. Rule 5. Data Languages. The system must support a least one relational language (It may support more than one relational language) that (a) has a linear syntax, (b) can be used in two ways and within application programs, (c) supports data operations security and integrity constraints, and transaction management operations (commit). Rule 6. View Updatability All views that are theoretically updatable must be updatable by the system. Rule 7. update and delete. The system must support INSERT, UPDATE, and DELETE operators. Rule 8. Physical data independence Changes to the physical level (how the data is stored, whether in arrays or linked lists etc.) must not require a change to an application based on the structure. Rule 9. Logical data independence Changes made to tables to modify any data stored in the tables must not require changes to be made to application programs. Logical data independence is more difficult to achieve than physical data independence. Rule 10. Integrity Constraints Integrity constraints must be specified separately from application programs and stored in the catalog. It must be possible to change such constraints when they are unnecessarily affecting existing applications. Rule 11. Database Distribution The RDBMS may spread across more than one system and across several networks, however the tables should appear in same manner to every user like local users. Rule 12. The Non Subversion rule If the system provides a low-level interface, then that interface cannot be used to weaken the system (e.g.) bypassing a relational security or integrity constraint. One joking version of this is: "The Key, the whole Key, and nothing but the Key, so help me CODD". Which means that any piece of data should be reliant on only one primary key in a table. Search the web for database design or data normalization or CODD or all of it. Alternately, try searching for Boyce-Codd Normal Form, which is a specific form of normalization for relational databases.

Edgar F Codd (considered to be the pioneer of the Relational Database Management System (RDBMS) concept) proposed 12 Rules (one could perhaps consider them as key characteristics) to determine if an RDBMS is truly an RDBMS. From [1], and many other text-book sources (particularly those written by CJ Date): 1. Information Rule 2. Guaranteed Access Rule 3. Systematic Treatment of Null Values 4. Dynamic Online Catalog Based on the Relational Model 5. Comprehensive Data Sublanguage Rule 6. View Updating Rule 7. High-Level Insert, Update, and Delete 8. Physical Data Independence 9. Logical Data Independence 10. Integrity Independence 11. Distribution Independence 12. Nonsubversion Rule Using these rules, there are actually very few systems which comes close to begin true RDBMSs

Selection and Repetition Control Structures Prepare a 3 to4 page paper that addresses the following- Selection Control Structures Explain how selection control structures increase the usefulness and?

SELECTION CONTROL STRUCTURES AND THEIR USE

A selection control structure is used to make a choice between two or more actions, depending on whether a condition is true or false. This condition is expressed with one of the relational operators like less than, greater than, equal to (<,>,=,<>,)etc. Adding selection structures makes the program a lot more structured and also gives the programmer a lot of flexibility. There are mainly four different kinds of selection control structures.

1. Simple selection

2. Simple selection with null false branch

3. Combined selection
4. Nested selection

Let us go through the control structures one by one relating them to real life examples.

1>Simple selection (Simple If statement):

Simple selection occurs when a choice is made between two alternate paths, depending on the result of a condition being true or false. The important keywords used are IF, THEN, ELSE and ENDIF.Let us take the example of a city where we want to count the sex ratio. For that we need to calculate the number of males and females. A pseudocode to solve the problem using a simple selection structure would be as follows

IF Gender = "M"

THEN

Increase Male-Count by one

ELSE

Increase Female-Count by one

ENDIF

2. Simple Selection with Null False Branch (null ELSE statement):

These kind of selection structures are used when we a task is performed only when a particular condition is true. If the mentioned condition is false, then there is no execution or processing and the IF statement is skipped or bypassed. The ELSEclause is not used. Thus the selection is between executing or bypassing an action. The important keywords used are IF, THEN, ELSE and ENDIF.

Let us take an example where we want to count the number of adults in a city. A pseudocode to solve the problem using a simple selection with null false branch would be as follows

IF AGE > 18

THEN

Increase Adult Count by one

ENDIF

3. Combined Selection(combined IF statement):

A combined IFstatement is one that contains multiple conditions, each connected with the logical operators AND or OR.

If the connector AND is used to combine two conditions, then both conditions must be true for the combined condition to be true.

First let us take an example of combined selection using AND. Say we want to count the number of females above the age of 18.The pseudocode would be

IF Age > 18 AND Gender = "F"

THEN

Increase Female-Adult-Count by one

ENDIF

If the connector ORis used to combine two conditions, then only one of the conditions needs to be true for the combined condition to be considered true.

Say we want to determine the tickets that can be priced at half rate for children and senior people. The pseudocode would be

IF Age < 12 OR Age > 65

THEN

Add 1 to Half-Price-Count

ENDIF

4. Nested Selection (nested IF statement)

A nested selection occurs when the word IF appears more than once within an IFstatement. A nested selection (IF) occurs when either the true of false branch of one If has another IF statement embedded within it.

This kind of structure is used when there are multiple conditions to choose from. For example while calculating tax the tax rate varies according to the gross salary.A simple pseudocode to count number of male and female adults will be

IF Age > 18

IF Gender = "F"

THEN

Increase Female-Adult-Count by one

ELSEIF Gender = "M"

THEN

Increase Male-Adult-Count by one

ENDIF

ENDIF

REPITITION CONTROL STRUCTURES AND THEIR USE

This type of control structures specify a block of one or more statements that are repeatedly executed until a condition is satisfied. These are also called iteration control structures. There are three different ways that a set of instructions can be repeated, and each way is determined by where the decision to repeat is placed:

- at the beginning of the loop (leading decision loop)

- at the end of the loop (trailing decision loop)

- a counted number of times (counted loop)

1. Leading Decision Loop:

In such loops the testing of the condition is at the beginning of the loop. Examples are DOWHILE loops. The only way to terminate the loop is to render the DO WHILE loop false. Consider a program to sell tickets. The program should sell tickets while there are tickets available. In such types of loops Leading Decision loops can be used to sell tickets until tickets are 0 which can be used as the termination statement.

2. Trailing Decision Loop:

In such structures the testing of condition is done at end of loop except that the logic to keep on repeating is same as in case of other repetition structures. REPEAT…UNTIL is an example of trailing decision loop. In trailing loops the statements are executed at least once before the condition is tested. These loops are sued in almost all kinds of computer program for e.g to print student records, to continue taking input until a certain limit, etc.

3. Counted Loop:

These are also known as DO or FOR loops. In such kind of repetition structures the programmer knows in advance the exact number of loop iterations. The loop execution is controlled by an important variable called the loop index. Say a programmer wants to input the salary record for 20 individuals. He will give the counted loops a high priority because he knows hp many times he wants to repeats the loop.

Finally we can conclude that selection control structures and repetition control structures find their use in almost any application. Using them wisely and judiciously depends on the person who is going to use these loops. Proper implementation of loop structures can reduce program complexity and cost a lot.

What is the example of DLL?

We all know that DLL is a short of Dynamic link library, which is a collection of subroutines stored on disk, and can be loaded into memory and executed when accessed by a running program. There are many dll files on the computer, for example, Iertutil.dll, wininet.dll, Vbrun300.dll, etc.

How many sides has a pollygone got?

theres an infant amount of them. pollygon just means many sides.

What is the difference between MUTEX and Semaphore?

From wikipedia:

"A mutex is a binary semaphore, usually including extra features like ownership or priority inversion protection. The differences between mutexes and semaphores are operating system dependent. Mutexes are meant to be used for mutual exclusion only and binary semaphores are meant to be used for event notification and mutual exclusion."

They also have a good example as to the use of a semaphore:

"A thread named A needs information from two databases before it can proceed. Access to these databases is controlled by two separate threads B, C. These two threads have a message-processing loop; anybody needing to use one of the databases posts a message into the corresponding thread's message queue. Thread A initializes a semaphore S with init(S,-1). A then posts a data request, including a pointer to the semaphore S, to both B and C. Then A calls P(S), which blocks. The other two threads meanwhile take their time obtaining the information; when each thread finishes obtaining the information, it calls V(S) on the passed semaphore. Only after both threads have completed will the semaphore's value be positive and A be able to continue. A semaphore used in this way is called a 'counting semaphore.'"

Basically think of a semaphore as a lock that allows multiple threads to wait in line for the resource to be free. Usually they will block and the semaphore will wake them up when it is their turn.

What is functions in c?

A function is a small set of instructions designed to operate on its given input (aka parameters or arguments) and perform some action or return some output. Generally in programming a commonly used strategy is to take a large program and break it into smaller chunks, which are turned into functions.

So say that you are writing a large program and constantly have to see which of two numbers is larger, you could write a function:

int larger(int a, int b)

{

if(a > b)

return a;

else

return b;

}

Now in your program, you can simply say:

int x = larger(number1, number2);

System analysis and design methodologies when building a hospital maintenance system?

Work System Analysis: The Key to Understanding Health Care Systems

Many articles in the medical literature state that medical errors are the result of systems problems, require systems analyses, and can only be addressed with systems solutions. Within that same body of literature is a growing recognition that human factors engineering methods and design principles are needed to reduce medical errors and, hence, increase patient safety. Work system analysis methods, which are based on industrial and human factors engineering tools, have much to contribute toward patient safety, specifically because of their focus on systems. They offer principles and methods for analyzing systems, which, if followed, should help health care administrators and clinicians properly analyze their units or facilities, and should lead to more robust patient safety interventions. In this paper, steps for executing a work system analysis are provided. To facilitate comprehension of the steps, the medication administration system is used as an example.

System analysis has much to contribute to patient safety, specifically through its study of organizational and work systems. In general, a system analysis yields an understanding of how a system works and how different elements in a system interact. This facilitates system design and system redesign, and aims to improve the interface between components of a system in order to enhance the functioning of each individual component in the overall system. Adopting a systems approach to error reduction requires a shift from blaming individuals for errors to analyzing systems to uncover design flaws, thus moving from addressing problems reactively (i.e., after problems occur) to proactively preventing accidents through system analysis and design.

Although many different methods have been used to conduct system analysis in industry, few methods have been widely used in health care. System analysis methodologies include, among others, the macroergonomic analysis and design (MEAD), 35, 36 fault tree analysis, 37, 38 failure modes and effects analysis (FMEA), 39, 40 health care failure modes and effects analysis (HFMEA), 41 and probabilistic risk assessment (PRA). 42, 43 Each of these methods uses similar principles to analyze and determine the weaknesses of the system and facilitate its redesign. In the remainder of this paper, the main steps that these methods share are identified and explained in detail.

Before presenting the main steps in a system analysis, an understanding of system terms must be developed. To facilitate reader comprehension of the terms and steps in the system analysis, the medication administration system will be used as an example throughout the remainder of the paper.

System element: A system element is anything that is part of a particular system. Elements can include people, technologies, policies, lighting, furniture, and jobs. In the case of the medication administration system, elements include the administering nurses, patients, medications, medication administration record (MAR), medication stock room, patient rooms, and identification bands.

System attribute: System attributes are the perceived characteristics of the system. The medication administration system attributes could include “error-free,” “time consuming,” “chaotic,” and “high quality.”

System boundary: System boundaries are zones between one system and another. These zones can be in time, space, process, or hierarchy.

Temporal boundary: A temporal boundary separates systems in time. For the medication administration system, a temporal boundary could be drawn between the first and second shift.

Spatial boundary: A spatial boundary separates systems in space. An example could be the medication administration system for one particular unit versus that of another unit.

Process boundary: A process boundary separates systems into adjacent component processes, also known as subprocesses. The medication use system contains component processes of ordering, transcribing, verifying, dispensing, administering, and documenting. An example of a process boundary might then be the boundary between the process of dispensing and delivering medications to the unit and the process of administering the medication.

Hierarchical boundary: A hierarchical boundary separates systems by their location in a hierarchy of systems. For example, the medication administration system exists within a larger system known as a unit. The unit exists within a larger system of a hospital. A hospital exists within a larger community health system.

System input: A system input is anything necessary to energize the system. For medication administration, inputs include nurses who administer drugs, drugs, MARs, physician orders, and pharmacy dispensing. These elements are inputs because they are necessary for medication administration to take place.

Program for twin prime numbers between 1 and 100?

There is 8: (3,5) (5,7) (11,13) (17,19) (29,31) (41,43) (59,61) (71,73)

What is the purpose of a queue system?

The purpose of a queue system is quite simple - it allows and maintains order in any situation where there is more than one person waiting for a service.