What is Pointer?

What is Pointer?

In computer science, a pointer is a programming language object, whose value refers to (or “points to”) another value stored elsewhere in the computer memory using its address. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer.

As an analogy, a page number in a book’s index could be considered a pointer to the corresponding page; dereferencing such a pointer would be done by flipping to the page with the given page number.

The term “Pointer” can also be defined as

  1. A variable does not store a value but store the address of the memory space which contains the value.
  2. A variable that contains the address of a location in memory. The location is the starting point of an allocated object, such as an object or value type, or the element of an array.
  3. A value that designates the address (i.e., the location in memory), of some value.
  4. Variables that hold a memory location.
  5. A memory address.

In general, Pointer is a long thin piece of metal on a scale or dial that moves to indicate a figure or position.

What is Logical Block Addressing (LBA)?

Logical Block Address (LBA)

Logical block addressing is a technique that allows a computer to address a hard disk larger than 528 megabytes. A Logical Block Address (LBA) is a 28-bit value that maps to a specific cylinder-head-sector address on the disk. 28 bits allows sufficient variation to specify addresses on a hard disk up to 8.4 gigabytes in data storage capacity.

The term “Logical block addressing” can also be defined as

  1. An address that defines where data is stored on the hard drive.
  2. A common scheme used for specifying the location of blocks of data stored on computer storage devices.
  3. A run-time function of the system BIOS. The BIOS uses LBA for the following commands: read (with and without retries), read verify, read long, write (with and without retries), write verify, write long, read multiple, write multiple, read DMA, write DMA, seek, and format track.

Interview Question : What is Hard Disk?

what-is-hard-disk-drive-hdd

A hard disk is part of a unit, often called a “disk drive,” “hard drive,” or “hard disk drive (HDD),” that stores and provides relatively quick access to large amounts of data on an electromagnetically charged surface or set of surfaces. Today’s computers typically come with a hard disk that contains several billion bytes (gigabytes) of storage.

A Hard disk can also be defined as:

  1. a rigid (“hard”) non-removable magnetic disk with a large data storage capacity.
  2. a data storage device used for storing and retrieving digital information using one or more rigid (“hard”) rapidly rotating disks (platters) coated with magnetic material.
  3. A magnetic disk on which you can store computer data. The term hard is used to distinguish it from a soft, or floppy disk. Hard disks hold more data and are faster than floppy disks.

Extra Information

A hard disk is really a set of stacked “disks,” each of which, like phonograph records, has data recorded electromagnetically in concentric circles or “tracks” on the disk. A “head” (something like a phonograph arm but in a relatively fixed position) records (writes) or reads the information on the tracks. Two heads, one on each side of a disk, read or write the data as the disk spins. Each read or write operation requires that data be located, which is an operation called a “seek.” (Data already in a disk cache, however, will be located more quickly.)

A hard disk/drive unit comes with a set rotation speed varying from 4500 to 7200 rpm. Disk access time is measured in milliseconds. Although the physical location can be identified with cylinder, track, and sector locations, these are actually mapped to a logical block address (LBA) that works with the larger address range on today’s hard disks.

To know more regarding the terms follow the post about Difference between Disc and Disk click here.

 

Interview Question : What is Thread?

Quad Core processor and Threads Winged Post

A thread is a single sequential flow of control within a program. the threads of a computer program allows the program to execute sequential actions or many actions at once. Each thread in a program identifies a process that runs when the program asks it to.

The term “Thread” can also be defined as

  1. a smallest unit of processing that can be scheduled by an Operating System.
  2. a portion of code that may be executed independently of the main program.
  3. an ordered sequence of instructions that tells the computer what to do
  4. In online discussion, a thread can refer to a series of related messages.
  5. In e-mail, a thread can refer to a series of replies back and forth pertaining a certain message.

Extended Information:

All programmers are familiar with writing sequential programs. You’ve probably written a program that displays “Hello World!” or sorts a list of names or computes a list of prime numbers. These are sequential programs. That is, each has a beginning, an execution sequence, and an end. At any given time during the runtime of the program, there is a single point of execution.

A thread is similar to the sequential programs described above. A single thread also has a beginning, a sequence, and an end. At any given time during the runtime of the thread, there is a single point of execution. However, a thread itself is not a program; a thread cannot run on its own. Rather, it runs within a program.

Some texts call a thread, a lightweight process. A thread is similar to a real process in that both have a single sequential flow of control. However, a thread is considered lightweight because it runs within the context of a full-blown program and takes advantage of the resources allocated for that program and the program’s environment.

Multiple threads can exists within the same process and share resources such as memory, while different processes do not share these resources.

 

Source / Courtesy : WiseGeek

Interview Question : What is Object Oriented Programming?

Object Oriented Programming Languages - Winged Post

Object Oriented Programming (OOP) is a type of programming in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure. In this way, the data structure becomes an object that includes both data and functions. In addition, programmers can create relationships between one object and another. For example, objects can inherit characteristics from other objects.

The Object Oriented Programming can also be defined as:

1. A style of programming that focuses on using objects to design and build applications.

2. Object oriented programming (OOP) is a model of programming language that focuses on the use of objects instead of actions in order to carry out tasks. This involves taking an approach that is more mindful of data and less concerned with logic, which is more commonly the case in other programming paradigms.

3. Object-oriented programming (OOP) is a programming paradigm based on the concept of “objects”, which are data structures that contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods.

 

For your information, the following are some additional concepts associated with the Object Oriented Programming:

  1. Encapsulation means that a group of related properties, methods, and other members are treated as a single unit or object.
  2. Inheritance describes the ability to create new classes based on an existing class.
  3. Polymorphism means that you can have multiple classes that can be used interchangeably, even though each class implements the same properties or methods in different ways.

 

Interview Question : Define Array.

multi dimentional array data structure Winged Post

Array is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. An array is stored so that the position of each element can be computed from its index tuple by a mathematical formula. The simplest type of data structure is a linear array, also called one-dimensional array.  We can also define a array as a container object which holds a fixed number of values of a single data type.

array data structure Winged Post

Arrays are among the oldest and most important data structures, and are used by almost every program. They are also used to implement many other data structures, such as lists and strings. They effectively exploit the addressing logic of computers. In most modern computers and many external storage devices, the memory is a one-dimensional array of words, whose indices are their addresses. Processors, especially vector processors, are often optimized for array operations.

Arrays are useful mostly because the element indices can be computed at run time. Among other things, this feature allows a single iterative statement to process arbitrarily many elements of an array. For that reason, the elements of an array data structure are required to have the same size and should use the same data representation.

The following are also the definitions of array in the area other than computer programming:

  • In general, an array is a number of items arranged in some specified way – for example, in a list or in a three-dimensional table.
  • In random access memory (RAM), an array is the arrangement of memory cells.
  • In data storage, an array (disk array) is a method for storing information on multiple devices. A disk array is a hardware element that contains a large group of hard disk drives (HDDs).

Easy Lesson on 1-Tier vs 2-Tier vs 3-Tier

Three-tier or multi-tier architecture is often used when describing how clients connect to database servers. But what does it all mean?

Let me try to explain this in non-technical terms (or as close to it I can get).

 

Software 

Let’s first take a look how a database software program (the software) works.

There are three major tiers to the software:

  • User Interface (UI). This is what you see when you work with the software. You interact with it. There  might be buttons, icons, text boxes, radio buttons, etc. The UI passes on clicks and typed information to the Business Logic tier.
  • Business Logic (BL). The business logic is code that is executed to accomplish something. When a user clicks a button it will trigger the BL to run some code. The BL can send information back to the UI, so the user can see the result of clicking a button or typing something in a field. For instance when you enter something in a cell in Excel, the BL will recalculate other cells once you hit Enter and the UI will present the new information to you. The BL also needs to be able to store and retrieve data and that is handled in the Database tier.
  • Database (DB). The database is where the data is stored and where the BL can retrieve it again.

 

1-Tier Architecture

This architecture has the UI, the BL, and the DB in one single software package. Software applications like MS Access, MS Excel, QuickBooks, and Peachtree all have the same in common: the application handles all three tiers (BL, UI, and DB). The data is stored in a file on the local computer or a shared drive. This is the simplest and cheapest of all the architectures, but also the least secure. Since users have direct access to the files, they could accidentally move, modify, or even worse, delete the file by accident or on purpose. There is also usually an issue when multiple users access the same file at the same time: In many cases only one can edit the file while others only have read-only access.

Another issue is that 1-tier software packages are not very scalable and if the amount to data gets too big, the software may be very slow or stop working.

So 1-tier architecture is simple and cheap, but usually unsecured and data can easily be lost if you are not careful.

00223092014

2-Tier Architecture

This architecture is also called Client-Server architecture because of the two components: The client that runs the application and the server that handles the database back-end. The client handles the UI and the BL and the server handles the DB. When the client starts, it establishes a connection to the server and communicates as needed with the server while running the client. The client computer usually can’t see the database directly and can only access the data by starting the client. This means that the data on the server is much more secure. Now users are unable to change or delete data unless they have specific user rights to do so.

The client-server solution also allows multiple users to access the database at the same time as long as they are accessing data in different parts of the database. One other huge benefit is that the server is processing data (DB) that allows the client to work on the presentation (UI) and business logic (BL) only. This mean that the client and the server are sharing the workload and by scaling the server to be more powerful than the client, you are usually able to load many clients to the server allowing more users to work on the system at the same time and at a much greater speed.

00323092014

3-Tier Architecture

In this architecture all three tiers are separated onto different computers. The UI runs on the client (what the user is working with). The BL is running on a separate server, called the business logic tier, middle tier, or service tier. Finally the DB is running on its own database server.

In the client-server solution the client was handling the UI and the BL that makes the client “thick”. A thick client means that it requires heavy traffic with the server, thus making it difficult to use over slower network connections like Internet and Wireless (4G, LTE, or Wi-Fi).

By introducing the middle tier, the client is only handling presentation logic (UI). This means that only little communication is needed between the client and the middle tier (BL) making the client “thin” or “thinner”. An example of a thin client is an Internet browser that allows you to see and provide information fast and almost with no delay.

As more users access the system a three-tier solution is more scalable than the other solution because you can add as many middle tiers (running on each ownserver) as needed to ensure good performance (N-tier or multiple-tier).

Security is also the best in the three-tier architecture because the middle tier protects the database tier.

There is one major drawback to the N-tier architecture and that is that the additional tiers increase the complexity and cost of the installation.

00423092014

1-Tier

2-Tier Multi-Tier
Benefits Very simple

Inexpensive

No server needed

Good security

More scalable

Faster execution

 

Exceptional security

Fastest execution

“Thin” client

Very scalable

Issues

Poor security

Multi user issues

More costly

More complex

“Thick” client

Very costly

Very complex

Users

Usually 1 (or a few)

2-100

50-2000 (+)