Summary

This document details computer input and output devices, including keyboards, mice, joysticks, and monitors. It provides a basic overview of each device and its function.

Full Transcript

Unit_2 Prepared By: Prof.Dhruvi Suthar Basic Screen & Keyboard Input & Output: An input/output device, often known as an IO device, is any hardware that allows a human operator or other systems to interface with a computer. Input/output devices, as the name implies, are capable of d...

Unit_2 Prepared By: Prof.Dhruvi Suthar Basic Screen & Keyboard Input & Output: An input/output device, often known as an IO device, is any hardware that allows a human operator or other systems to interface with a computer. Input/output devices, as the name implies, are capable of delivering data (output) to and receiving data from a computer (input). An input/output (I/O) device is a piece of hardware that can take, output, or process data. It receives data as input and provides it to a computer, as well as sends computer data to storage media as a storage output. Input Devices Input devices are the devices that are used to send signals to the computer for performing tasks. The receiver at the end is the CPU (Central Processing Unit), which works to send signals to the output devices. Some of the classifications of Input devices are: Keyboard Devices Pointing Devices Composite Devices Game Controller Visual Devices Audio Input Devices Some of the input devices are described below. Keyboard The keyboard is the most frequent and widely used input device for entering data into a computer. Although there are some additional keys for performing other operations, the keyboard layout is similar to that of a typical typewriter. Generally, keyboards come in two sizes: 84 keys or 101/102 keys but currently keyboards with 104 keys or 108 keys are also available for Windows and the Internet. Types of Keys Numeric Keys: It is used to enter numeric data or move the cursor. It usually consists of a set of 17 keys. Typing Keys: The letter keys (A-Z) and number keys (09) are among these keys. Control Keys: These keys control the pointer and the screen. There are four directional arrow keys on it. Home, End, Insert, Alternate(Alt), Delete, Control(Ctrl), etc., and Escape are all control keys (Esc). Special Keys: Enter, Shift, Caps Lock, Num Lock, Tab, etc., and Print Screen are among the special function keys on the keyboard. Function Keys: The 12 keys from F1 to F12 are on the topmost row of the keyboard. Mouse The most common pointing device is the mouse. The mouse is used to move a little cursor across the screen while clicking and dragging. The cursor will stop if you let go of the mouse. The computer is dependent on you to move the mouse; it won’t move by itself. As a result, it’s an input device. A mouse is an input device that lets you move the mouse on a flat surface to control the coordinates and movement of the on-screen cursor/pointer. The left mouse button can be used to select or move items, while the right mouse button when clicked displays extra menus. Joystick A joystick is a pointing device that is used to move the cursor on a computer screen. A spherical ball is attached to both the bottom and top ends of the stick. In a socket, the lower spherical ball slides. You can move the joystick in all four directions. The joystick’s function is comparable to that of a mouse. It is primarily used in CAD (Computer-Aided Design) and playing video games on the computer. Track Ball Track Ball is an accessory for notebooks and laptops, which works on behalf of a mouse. It has a similar structure to a mouse. Its structure is like a half-inserted ball and we use fingers for cursor movement. Different shapes are used for this like balls, buttons, or squares. Light Pen A light pen is a type of pointing device that looks like a pen. It can be used to select a menu item or to draw on the monitor screen. A photocell and an optical system are enclosed in a tiny tube. When the tip of a light pen is moved across a monitor screen while the pen button is pushed, the photocell sensor element identifies the screen location and provides a signal to the CPU. Scanner A scanner is an input device that functions similarly to a photocopier. It’s employed when there’s information on paper that needs to be transferred to the computer’s hard disc for subsequent manipulation. The scanner collects images from the source and converts them to a digital format that may be saved on a disc. Before they are printed, these images can be modified. Output Devices Output Devices are the devices that show us the result after giving the input to a computer system. Output can be of many different forms like image, graphic audio, video, etc. Some of the output devices are described below. Monitor Monitors, also known as Visual Display Units (VDUs), are a computer’s primary output device. It creates images by arranging small dots, known as pixels, in a rectangular pattern. The amount of pixels determines the image’s sharpness. The two kinds of viewing screens used for monitors are described below. Cathode-Ray Tube (CRT) Monitor: Pixels are minuscule visual elements that make up a CRT display. The higher the image quality or resolution, the smaller the pixels. Flat-Panel Display Monitor: In comparison to the CRT, a flat-panel display is a type of video display with less volume, weight, and power consumption. They can be hung on the wall or worn on the wrist. Television Television is one of the common output devices which is present in each and every house. It portrays video and audio files on the screen as the user handles the television. Nowadays, we are using plasma displays as compared to CRT screens which we used earlier. Printer Printers are output devices that allow you to print information on paper. There are certain types of printers which are described below. Impact Printers Character Printers Line Printers Non-Impact Printers Laser Printers Inkjet Printers Decision Making Statements: In C, decision-making statements are technology structures enabling programmers to make decisions based on specific conditions or criteria. The conditional statements (also known as decision control structures) such as if, if else, switch, etc. are used for decision-making purposes in C programs. They are also known as Decision-Making Statements and are used to evaluate one or more conditions and make the decision whether to execute a set of statements or not. These decision-making statements in programming languages decide the direction of the flow of program execution. Need of Conditional Statements There come situations in real life when we need to make some decisions and based on these decisions, we decide what should we do next. Similar situations arise in programming also where we need to make some decisions and based on these decisions we will execute the next block of code. For example, in C if x occurs then execute y else execute z. There can also be multiple conditions like in C if x occurs then execute p, else if condition y occurs execute q, else execute r. This condition of C else-if is one of the many ways of importing multiple conditions. Decision making statements Decision making statements help you to make a decision based on certain conditions. These conditions are specified by a set of conditional statements having boolean expressions which are evaluated to a boolean value true or false. There are following types of conditional statements in C. If statement If-Else statement Nested If-else statement If-Else If ladder Switch statement If Statement The single if statement in C language is used to execute the code if a condition is true.It is also called one-way selection statement. Syntax if(expression) { //code to be executed } Example of If Statement #include #include void main() { int num=0; printf("enter the number"); scanf("%d",&num); if(n%2==0) { printf("%d number in even",num); } getch(); } If Else Statement The if-else statement in C language is used to execute the code if the condition is true or false. It is also called a two-way selection statement. Syntax if(expression) { //Statements } else { //Statements } If the expression is evaluated to nonzero (true) then if block statement(s) are executed. If the expression is evaluated to zero (false) then else block statement(s) are executed. Example of If Else Statement #include #include void main() { int num=0; printf("enter the number"); scanf("%d",&num); if(n%2==0) { printf("%d number in even", num); } else { printf("%d number in odd",num); } getch(); } Nested If – Else Statement The nested if...else statement is used when a program requires more than one test expression. It is also called a multi-way selection statement. When a series of the decision are involved in a statement, we use the if else statement in nested form. Syntax if( expression ) { if( expression1 ) { statement-block1; } else { statement-block 2; } } else { statement-block 3; } Example of Nested If – Else Statement #include #include void main( ) { int a,b,c; clrscr(); printf("Please Enter 3 number); scanf("%d%d%d",&a,&b, &c); if(a>b) { if(a>c) { printf("a is greatest"); } else { printf("c is greatest"); } } else { if(b>c) { printf("b is greatest"); } else { printf("c is greatest"); } } getch(); } If..else If ladder The if-else-if statement is used to execute one code from multiple conditions. It is also called a multipath decision statement. It is a chain of if..else statements in which each if statement is associated with another if statement and last would be an else statement. Syntax if(condition1) { //statements } else if(condition2) { //statements } else if(condition3) { //statements } else { //statements } Example of if…else if ladder #include #include void main( ) { int a; printf("enter a number"); scanf("%d",&a); if( a%5==0 && a%8==0) { printf("divisible by both 5 and 8"); } else if( a%8==0 ) { printf("divisible by 8"); } else if(a%5==0) { printf("divisible by 5"); } else { printf("divisible by none"); } getch(); } Switch Statement Switch statement acts as a substitute for a long if-else-if ladder that is used to test a list of cases. A switch statement contains one or more case labels which are tested against the switch expression. When the expression matches a case then the associated statements with that case would be executed. Syntax Switch (expression) { case value1: //Statements break; case value 2: //Statements break; case value 3: //Statements case value n: //Statements break; Default: //Statements } Example of Switch Statement #include #include void main() { int no; printf("\n Enter Day no between 1- 7 :"); scanf("%d",&no); switch(no) { case 1: printf("\n Sunday"); break; case 2: printf("\n Monday"); break; case 3: printf("\n Tuesday"); break; case 4: printf("\n Wednesday"); break; case 5: printf("\n Thursday"); break; case 6: printf("\n Friday"); break; case 7: printf("\n Saturday"); break; default: printf("\n Please Enter Proper Input"); break; } getch(); } Looping Statements Looping Statements in C execute the sequence of statements many times until the stated condition becomes false. A loop in C consists of two parts, a body of a loop and a control statement. The control statement is a combination of some conditions that direct the body of the loop to execute until the specified condition becomes false. The purpose of the C loop is to repeat the same code a number of times. Types of Loops in C Depending upon the position of a control statement in a program, looping statement in C is classified into two types: 1. Entry controlled loop 2. Exit controlled loop In an entry control loop in C, a condition is checked before executing the body of a loop. It is also called a pre-checking loop. In an exit controlled loop, a condition is checked after executing the body of a loop. It is also called a post-checking loop. The control conditions must be well defined and specified otherwise the loop will execute an infinite number of times. The loop that does not stop executing and processes the statements number of times is called an infinite loop. An infinite loop is also called an “Endless loop.” Characteristics of an infinite loop: No termination condition is specified. The specified conditions never meet. The specified condition determines whether to execute the loop body or not. There are three types of loop constructs: 1. The while loop 2. The do-while loop 3. The for loop While Loop : In a while loop, a condition is evaluated before processing a body of the loop. If a condition is true then and only then the body of a loop is executed. Do-While Loop : In a do…while loop, the condition is always executed after the body of a loop. It is also called an exit-controlled loop. For Loop : In a for loop, the initial value is performed only once, then the condition tests and compares the counter to a fixed value after each iteration, stopping the for loop when false is returned. While Loop in C A while loop is the most straightforward looping structure. Syntax of While Loop in C: while (condition) { statements; } It is an entry-controlled loop. In a while loop, a condition is evaluated before processing a body of the loop. If a condition is true then and only then the body of a loop is executed. After the body of a loop is executed then control again goes back at the beginning, and the condition is checked if it is true, the same process is executed until the condition becomes false. Once the condition becomes false, the control goes out of the loop. After exiting the loop, the control goes to the statements which are immediately after the loop. The body of a loop can contain more than one statement. If it contains only one statement, then the curly braces are not compulsory. It is a good practice though to use the curly braces even if we have a single statement in the body. In a while loop, if the condition is not true, then the body of a loop will not be executed, not even once. Example: #include #include int main() { int num=1; //initializing the variable while(num

Use Quizgecko on...
Browser
Browser