Monday 29 December 2014

SOME GENERAL QUESTIONS ABOUT C++

Questions and Answers C++ 

Question : Why main function is special in C++ ?

Answer : Whenever a C++ program is executed, execution of the program starts and ends at main(). The main is the driver function of the program. If it is not present in a program, no execution can take place.


Question : What is run-time error, logical error and syntax error?

Answer : Syntax error -
 The errors which are traced by the compiler during compilation, due to wrong grammar for the language used in the program, are called syntax errors.
For example,

cin<<a; // instead of extraction operator insertion operator is used.
Run time Error -
 
The errors encountered during execution of the program, due to unexpected input or output are called run-time error.
For example - 

a=n/0; // division by zero 
Logical Error -

These errors are encountered when the program does not give the desired output, due to wrong logic of the program.
For example :
 
remainder = a+b // instead of using % operator + operator is used.


Question : What is the role of #include directive in C++?

Answer : The preprocessor directive #include tells the complier to insert another file into your source file. In effect, #include directive is replaced by the contents of the file indicated.


Question : What is compiler and linker?

Answer : Compiler - It is a program which converts the program written in a programming language to a program in machine language.
Linker - It is a program which links a complied program to the necessary library routines, to make it an executable program.


 Question : Why is char often treated as integer data type in C++ ?

Answer : The memory implementation of char data type is in terms of the number code. Therefore, it is said to be another integer data type.


Question : What is type conversion in C++ ?

Answer : When two operands of different data types are encountered in the same expression, the variable of lower data type is automatically converted to the data tpes of variable with higher data type, and then the expression is calculated.
For example: int a=98; float b=5; cout<<a/3.0; //converts to float type, since 3.0 is of float type.
cout<<a/b; // converts a temporarily to float type, since b is of float type, and gives the result 19.6.



Question : What is type casting in C++ ?

Answer : Type casting refers to the data type conversions specified by the programmer, as opposed to the automatic type conversions. This can be done when the compiler does not do the conversions automatically. Type casting can be done to higher or lower data type.
For example : cout<<(float)12/5; //displays 2.4, since 12 is converted to float type.



Question : What is the effect of absence of break in switch case in C++ ?

Answer : The break keyword causes the entire switch statement to exit, and the control is passed to statement following the switch.. case construct. Without break, the control passes to the statements for the next case. The break statement is optional in switch..case construct.


Question : In control structure switch-case what is the purpose of default in C++ ?

Answer : This keyword gives the switch..case construct a way to take an action if the value of the switch variable does not match with any of the case constants. No break statement is necessary after default case, since the control is already at the end of switch..case construct. The default is optional in case of switch..case construct.


Question : What is the difference between while and do-while loop?

Answer : While is an Entry Controlled Loop, the body of the loop may not execute even once if the test expression evaluates to be false the first time, whereas in do..while, the loop is executed at least once whether the condition holds true the first time or not. more details


Question : What is the difference between call by value and call by reference in a user defined function in C++?

Answer : The value of the actual parameters in the calling function do not get affected when the arguments are passed using call by value method, since actual and formal parameters have different memory locations.
The values of the formal parameters affect the values of actual parameters in the calling function, when the arguments are passed using call by reference method. This happens since the formal parameters are not allocated any memory, but they refer to the memory locations of their corresponding actual parameters.



Question : What is preprocessor directive?

Answer : A preprocessor directive is an instruction to the complier itself. A part of compiler called preprocessor deals with these directives, before real compilation process. # is used as preprocessor directive in C++.


Question : What is the difference between local variable and global variable?

Answer : Local variables are those variables which are declared within a function or a compound statement and these variables can only be used within that function/scope. They cannot be accessed from outside the function or a scope of it's declaration. This means that we can have variables with the same names in different functions/scope. Local variables are local to the function/scope in which they are declared.
Global variables are those variables which are declared in the beginning of the program. They are not declared within a function. So, these variables can be accessed by any function of the program. So, global variables are global to all the functions of the program.



Question : What is the role of #define in C++?

Answer : It is a preprocessor directive to define a macro in a C++ program. Macros provide a mechanism for token replacement with or without a set of formal, function line parameters. For example :
#define PIE 3.1416
#define AVG(A,B,C) (A+B+C)/3






Tuesday 23 December 2014

IPHONE 6

IPHONE 6

iPhone 6 features an A8 chip built on second-generation 64-bit desktop-class architecture. Its incredible power is enhanced by an M8 motion coprocessor that efficiently measures your activity from advanced sensors, including a new barometer. So you can do more, for longer periods of time, with better performance and battery life.


CHARACTERISTICS OF IPHONE 6


A8 uses an advanced 20-nanometer process. It’s a remarkably small and efficient chip on which two billion transistors deliver incredible performance with up to 50 percent more energy efficiency than the A7 chip.NBC
Apple has launched two new iPhones, the 4.7-inch iPhone 6 and the 5.5-inch iPhone 6 Plus. Along with larger screens and a completely new iPad-style design with an ultra thin body and rounded corners, the two new phones offer faster processors, better cameras, and Apple's new Apple Pay payment system.
iPhone 6 is designed to be incredibly eļ¬ƒcient. So you can spend your day taking advantage of all its new features and apps while getting better battery life.


              FEATURES OF IPHONE 6

The iPhone 6 and iPhone 6 Plus are the two new iPhone models for 2014. Apple announced larger iPhone 6 screens, a completely new design and upgraded features like the ability to make payments using Apple Pay and connecting to the Apple Watch.

In creating iPhone 6, we scrutinized every element and material. That’s how we arrived at a smooth, continuous form. A thinner profile made possible by our thinnest display yet. And intuitively placed buttons. All made with beautiful anodized aluminum, stainless steel, and glass. It’s a thousand tiny details that add up to something big. Or in this case, two big things: iPhone 6 and iPhone 6 Plus.
                       
                                                                                                                                         

ANDROID

Android Versions

Android  Versions:

                                                   The android versions are:
1-Android 1.5 Cupcake.
2-Android 1.6 Donut.
3-Android 2.0 Eclair.
4-Android 2.2 Froyo.
5-Android 2.3 Gingerbread.
6-Android 3.0 Honeycomb. 
7-Android 4.0 Ice Cream Sandwich.
8-Android 4.1 Jelly Bean.
9-Android 4.4 KitKat.
10-Android 5.0 Lollipop.
11.Android 6.0 Milkshake


ANDROID 5.0 LOLLIPOP: 10 highlights of the latest version of Google's Android operating system


1.Notifications:
 The notifications feature in Android Lollipop offers new ways to control when and how you receive messages - only get interrupted when you want to be. In Android 5.0, users can view and respond to messages directly from the lock screen. Users can also includes the ability to hide sensitive content for these notifications. Priority mode can be turned on via their device's volume button so only certain people and notifications get through. With Lollipop, incoming phone calls won't interrupt what you're watching or playing. You can choose to answer the call or just keep doing what you're doing. It is claimed to have more intelligent ranking of notifications based on who they are from.
2. Battery:
 A battery saver feature in Android Lollipop is claimed to extend device use by up to 90 minutes. It also displays the estimated time left to fully charge when your device is plugged in. Also, the estimated time left on your device before you need to charge again can now be found in battery settings.
3. Security:
 Android Lollipop devices will come with encryption automatically turned on to help protect data on lost or stolen devices.
4.Device Sharing: 
This is one of the key features in Android Lollipop. Multiple users for a single phone is now possible. If you forget your phone, you still can call any of your friends (or access any of your messages and photos) by simply logging into another Android phone running Lollipop. The Guest user feature for phones and tablets means you can lend your device and not your stuff. Also you can screen your pin so another user can access just that content without messing with your other stuff.
5. New Quick Settings: 
The Quick Settings will now have handy controls like flashlight, hotspot, screen rotation and cast screen controls, and easier on/off toggles for WiFi, Bluetooth, and location
6. Runtime and Performance: 
Support for 64 bit devices, like the Nexus 9, brings desktop class CPUs to Android
7.Media:
 USB Audio support lets users plug USB microphones, speakers, and a myriad of other USB audio devices like amplifiers and mixers into their Android device.

8.Now in 68+ languages: 
With Android Lollipop comes support for 15 other languages including Basque, Bengali, Burmese, Chinese (Hong Kong), Galician, Icelandic, Kannada, Kyrgyz, Macedonian, Malayalam, Marathi, Nepali, Sinhala, Tamil, Telugu.

9..Material Design:
 It is one of the highlights of the new Android OS that would create a consistent experience across all your devices. Offering a responsive GUI design, Android 5.0 Lollipop "is designed to be flexible, to work on all your devices and to be customized for you the way you see fit," said Google vice president Sundar Pichai, who heads the Android operations. The songs, photos, apps, and even recent searches from one of your Android devices can be immediately enjoyed across all of your Android devices.

Wednesday 17 December 2014

Types of RAM

Types of RAM


The following are some common types of RAM:
SRAM:
               Static random access memory uses multiple transistors, typically four to six, for each memory cell but doesn't have a capacitor in each cell. It is used primarily for cache.
DRAM:
               Dynamic random access memory has memory cells with a paired transistor and capacitorrequiring constant refreshing.
FPM DRAM:
                         Fast page mode dynamic random access memory was the original form of DRAM. It waits through the entire process of locating a bit of data by column and row and then reading the bit before it starts on the next bit. Maximum transfer rate to L2 cache is approximately 176 MBps.
EDO DRAM:
                         Extended data-out dynamic random access memory does not wait for all of the processing of the first bit before continuing to the next one. As soon as the address of the first bit is located, EDO DRAM begins looking for the next bit. It is about five percent faster than FPM. Maximum transfer rate to L2 cache is approximately 264 MBps.
SD RAM:
                 Synchronous dynamic random access memory takes advantage of the burst mode concept to greatly improve performance. It does this by staying on the row containing the requested bit and moving rapidly through the columns, reading each bit as it goes. The idea is that most of the time the data needed by the CPU will be in sequence. SDRAM is about five percent faster than EDO RAM and is the most common form in desktops today. Maximum transfer rate to L2 cache is approximately 528 MBps.
DDR SDRAM:
                           Double data rate synchronous dynamic RAM is just like SDRAM except that is has higher bandwidth, meaning greater speed. Maximum transfer rate to L2 cache is approximately 1,064 MBps (for DDR SDRAM 133 MHZ).
RD RAM: 
                    Rambus dynamic random access memory is a radical departure from the previous DRAM architecture. Designed by Rambus, RDRAM uses a Rambus in-line memory module (RIMM), which is similar in size and pin configuration to a standard DIMM. What makes RDRAM so different is its use of a special high-speed data bus called the Rambus channel. RDRAM memory chips work in parallel to achieve a data rate of 800 MHz, or 1,600 MBps. Since they operate at such high speeds, they generate much more heat than other types of chips. To help dissipate the excess heat Rambus chips are fitted with a heat spreader, which looks like a long thin wafer. Just like there are smaller versions of DIMMs, there are also SO-RIMMs, designed for notebook computers.
Credit card Memory: 
                                         Credit card memory is a proprietary self-contained DRAM memory module that plugs into a special slot for use in notebook computers.
PCMCIA Memory Card:
                                             Another self-contained DRAM module for notebooks, cards of this type are not proprietary and should work with any notebook computer whose system bus matches the memory card's configuration.
CMOS RAM: 
                          CMOS RAM is a term for the small amount of memory used by your computer and some other devices to remember things like hard disk settings -- see Why does my computer need a battery? for details. This memory uses a small battery to provide it with the power it needs to maintain the memory contents.
VRAM:
              VideoRAM, also known as multiport dynamic random access memory (MPDRAM), is a type of RAM used specifically for video adapters or 3-D accelerators. The "multiport" part comes from the fact that VRAM normally has two independent access ports instead of one, allowing the CPU and graphics processor to access the RAM simultaneously. VRAM is located on the graphics card and comes in a variety of formats, many of which are proprietary. The amount of VRAM is a determining factor in theresolution and color depth of the display. VRAM is also used to hold graphics-specific information such as3-D geometry data and texture maps. True multiport VRAM tends to be expensive, so today, many graphics cards use SGRAM (synchronous graphics RAM) instead. Performance is nearly the same, but SGRAM is cheaper.

Output Devices

Output Devices

Following are few of the important output devices which are used in a computer.
  • Monitors
  • Graphic Plotter
  • Printer

Monitors

Monitors, commonly called as Visual Display Unit (VDU), are the main output device of a computer. It forms images from tiny dots, called pixels that are arranged in a rectangular form. The sharpness of the image depends upon the number of pixels.
There are two kinds of viewing screen used for monitors.
  • Cathode-Ray Tube (CRT)
  • Flat- Panel Display

Cathode-Ray Tube (CRT) Monitor

The CRT display is made up of small picture elements called pixels. The smaller the pixels, the better the image clarity, or resolution. It takes more than one illuminated pixel to form whole character, such as the letter ‘e’ in the word help.
A finite number of characters can be displayed on a screen at once. The screen can be divided into a series of character boxes - fixed location on the screen where a standard character can be placed. Most screens are capable of displaying 80 characters of data horizontally and 25 lines vertically. There are some disadvantages of CRT:
  • Large in Size
  • High power consumption
CRT Monitor

Flat-Panel Display Monitor

The flat-panel display refers to a class of video devices that have reduced volume, weight and power requirement in comparison to the CRT. You can hang them on walls or wear them on your wrists. Current uses of flat-panel displays include calculators, video games, monitors, laptop computer, graphics display.
The flat-panel display is divided into two categories:
  • Emissive Displays - The emissive displays are devices that convert electrical energy into light. Example are plasma panel and LED(Light-Emitting Diodes).
  • Non-Emissive Displays - The Non-emissive displays use optical effects to convert sunlight or light from some other source into graphics patterns. Example is LCD(Liquid-Crystal Device)
Flat Monitor

Printers

Printer is an output device, which is used to print information on paper.
There are two types of printers:
  • Impact Printers
  • Non-Impact Printers

Impact Printers

The impact printers print the characters by striking them on the ribbon which is then pressed on the paper.
Characteristics of Impact Printers are the following:
  • Very low consumable costs
  • Very noisy
  • Useful for bulk printing due to low cost
  • There is physical contact with the paper to produce an image
These printers are of two types
  • Character printers
  • Line printers

Character Printers

Character printers are the printers which print one character at a time.
These are further divided into two types:
  • Dot Matrix Printer(DMP)
  • Daisy Wheel

DOT MATRIX PRINTER

In the market one of the most popular printers is Dot Matrix Printer. These printers are popular because of their ease of printing and economical price. Each character printed is in form of pattern of dots and head consists of a Matrix of Pins of size (5*7, 7*9, 9*7 or 9*9) which come out to form a character that is why it is called Dot Matrix Printer.
Advantages
  • Inexpensive
  • Widely Used
  • Other language characters can be printed
Disadvantages
  • Slow Speed
  • Poor Quality
Dot Matrix Printer

DAISY WHEEL

Head is lying on a wheel and pins corresponding to characters are like petals of Daisy (flower name) that is why it is called Daisy Wheel Printer. These printers are generally used for word-processing in offices which require a few letters to be sent here and there with very nice quality.
Advantages
  • More reliable than DMP
  • Better quality
  • The fonts of character can be easily changed
Disadvantages
  • Slower than DMP
  • Noisy
  • More expensive than DMP
Daisy Wheel Printer

Line Printers

Line printers are the printers which print one line at a time.
Line Printer
These are of further two types
  • Drum Printer
  • Chain Printer

DRUM PRINTER

This printer is like a drum in shape so it is called drum printer. The surface of drum is divided into number of tracks. Total tracks are equal to size of paper i.e. for a paper width of 132 characters, drum will have 132 tracks. A character set is embossed on track. The different character sets available in the market are 48 character set, 64 and 96 characters set. One rotation of drum prints one line. Drum printers are fast in speed and can print 300 to 2000 lines per minute.
Advantages
  • Very high speed
Disadvantages
  • Very expensive
  • Characters fonts cannot be changed

CHAIN PRINTER

In this printer, chain of character sets are used so it is called Chain Printer. A standard character set may have 48, 64, or 96 characters.
Advantages
  • Character fonts can easily be changed.
  • Different languages can be used with the same printer.
Disadvantages
  • Noisy

Non-impact Printers

Non-impact printers print the characters without using ribbon. These printers print a complete page at a time so they are also called as Page Printers.
These printers are of two types
  • Laser Printers
  • Inkjet Printers

Characteristics of Non-impact Printers

  • Faster than impact printers.
  • They are not noisy.
  • High quality.
  • Support many fonts and different character size.

Laser Printers

These are non-impact page printers. They use laser lights to produce the dots needed to form the characters to be printed on a page.

ADVANTAGES

  • Very high speed
  • Very high quality output
  • Give good graphics quality
  • Support many fonts and different character size

DISADVANTAGES

  • Expensive.
  • Cannot be used to produce multiple copies of a document in a single printing.
Laser Printer

INPUT DEVICES

INPUT DEVICES

Following are few of the important input devices which are used in a computer:
  • Keyboard
  • Mouse
  • Joy Stick
  • Light pen
  • Track Ball
  • Scanner
  • Graphic Tablet
  • Microphone
  • Magnetic Ink Card Reader(MICR)
  • Optical Character Reader(OCR)
  • Bar Code Reader
  • Optical Mark Reader(OMR)

Keyboard

Keyboard is the most common and very popular input device which helps in inputting data to the computer. The layout of the keyboard is like that of traditional typewriter, although there are some additional keys provided for performing additional functions.
Keyboards are of two sizes 84 keys or 101/102 keys, but now keyboards with 104 keys or 108 keys are also available for Windows and Internet.
The keys on the keyboard are as follows:
Sr.NoKeysDescription
1Typing KeysThese keys include the letter keys (A-Z) and digit keys (0-9) which generally give same layout as that of typewriters.
2Numeric KeypadIt is used to enter numeric data or cursor movement. Generally, it consists of a set of 17 keys that are laid out in the same configuration used by most adding machines and calculators.
3Function KeysThe twelve function keys are present on the keyboard which are arranged in a row at the top of the keyboard. Each function key has unique meaning and is used for some specific purpose.
4Control keysThese keys provide cursor and screen control. It includes four directional arrow keys. Control keys also include Home, End, Insert, Delete, Page Up, Page Down, Control(Ctrl), Alternate(Alt), Escape(Esc).
5Special Purpose KeysKeyboard also contains some special purpose keys such as Enter, Shift, Caps Lock, Num Lock, Space bar, Tab, and Print Screen.
KeyboardMouse
Mouse is most popular pointing device. It is a very famous cursor-control device having a small palm size box with a round ball at its base which senses the movement of mouse and sends corresponding signals to CPU when the mouse buttons are pressed.
Generally it has two buttons called left and right button and a wheel is present between the buttons. Mouse can be used to control the position of cursor on screen, but it cannot be used to enter text into the computer.

Advantages

  • Easy to use
  • Not very expensive
  • Moves the cursor faster than the arrow keys of keyboard.
Mouse

Joystick

Joystick is also a pointing device which is used to move cursor position on a monitor screen. It is a stick having a spherical ball at its both lower and upper ends. The lower spherical ball moves in a socket. The joystick can be moved in all four directions.
The function of joystick is similar to that of a mouse. It is mainly used in Computer Aided Designing(CAD) and playing computer games.
Joystick

Light Pen

Light pen is a pointing device which is similar to a pen. It is used to select a displayed menu item or draw pictures on the monitor screen. It consists of a photocell and an optical system placed in a small tube. When the tip of a light pen is moved over the monitor screen and pen button is pressed, its photocell sensing element detects the screen location and sends the corresponding signal to the CPU.
Light Pen

Track Ball

Track ball is an input device that is mostly used in notebook or laptop computer, instead of a mouse. This is a ball which is half inserted and by moving fingers on ball, pointer can be moved. Since the whole device is not moved, a track ball requires less space than a mouse. A track ball comes in various shapes like a ball, a button and a square.
Track Ball

Scanner

Scanner is an input device which works more like a photocopy machine. It is used when some information is available on a paper and it is to be transferred to the hard disc of the computer for further manipulation. Scanner captures images from the source which are then converted into the digital form that can be stored on the disc. These images can be edited before they are printed.
Scanner

Digitizer

Digitizer is an input device which converts analog information into digital form. Digitizer can convert a signal from the television or camera into a series of numbers that could be stored in a computer. They can be used by the computer to create a picture of whatever the camera had been pointed at. Digitizer is also known as Tablet or Graphics Tablet because it converts graphics and pictorial data into binary inputs. A graphic tablet as digitizer is used for doing fine works of drawing and image manipulation applications.
Graphic Tablet

Microphone

Microphone is an input device to input sound that is then stored in digital form. The microphone is used for various applications like adding sound to a multimedia presentation or for mixing music.
Microphone

Magnetic Ink Card Reader(MICR)

MICR input device is generally used in banks because of a large number of cheques to be processed every day. The bank's code number and cheque number are printed on the cheques with a special type of ink that contains particles of magnetic material that are machine readable. This reading process is called Magnetic Ink Character Recognition (MICR). The main advantages of MICR is that it is fast and less error prone.
Magnetic Ink Card Reader(MICR)

Optical Character Reader(OCR)

OCR is an input device used to read a printed text. OCR scans text optically character by character, converts them into a machine readable code and stores the text on the system memory.
Optical Character Reader(OCR)

Bar Code Readers

Bar Code Reader is a device used for reading bar coded data (data in form of light and dark lines). Bar coded data is generally used in labelling goods, numbering the books etc. It may be a hand held scanner or may be embedded in a stationary scanner. Bar Code Reader scans a bar code image, converts it into an alphanumeric value which is then fed to the computer to which bar code reader is connected.
Barcode Reader

Optical Mark Reader(OMR)

OMR is a special type of optical scanner used to recognize the type of mark made by pen or pencil. It is used where one out of a few alternatives is to be selected and marked. It is specially used for checking the answer sheets of examinations having multiple choice questions.
Optical Mark Reader(OMR)