Sunday, 9 March 2014

Compiler, Interpreter & Assembler

COMPILER
A program that translates source code into object code. The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instructions. A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable program.

The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine code). If the compiled program can run on a computer whose CPU or operating system is different from the one on which the compiler runs, the compiler is known as a cross-compiler. A program that translates from a low level language to a higher level one is a decompiler. A program that translates between high-level languages is usually called a language translator, source to source translator, or language converter. A language rewriter is usually a program that translates the form of expressions without a change of language.

A compiler is likely to perform many or all of the following operations: lexical analysis, preprocessing, parsing, semantic analysis (Syntax-directed translation), code generation, and code optimization.


History:

Software for early computers was primarily written in assembly language. Higher level programming languages were not invented until the benefits of being able to reuse software on different kinds of CPUs started to become significantly greater than the costs of writing a compiler. The limited memory capacity of early computers led to substantial technical challenges when the first compilers were being designed.

Towards the end of the 1950s, machine-independent programming languages were first proposed. Subsequently several experimental compilers were developed. It is believed that the first compiler was written by Grace Hopper, in 1952, for the A-0 programming language.The A-0 functioned more as a loader or linker than the modern notion of a compiler. The first autocode and its compiler were developed by Alick Glennie in 1952 for the Mark 1 computer at the University of Manchester and is considered by some to be the first compiled programming language. The FORTRAN team led by John Backus at IBM is generally credited as having introduced the first complete compiler in 1957. COBOL was an early language to be compiled on multiple architectures, in 1960.

Early compilers were written in assembly language. The first self-hosting compiler – capable of compiling its own source code in a high-level language – was created in 1962 for Lisp by Tim Hart and Mike Levin at MIT. Since the 1970s it has become common practice to implement a compiler in the language it compiles, although both Pascal and C have been popular choices for implementation language. Building a self-hosting compiler is a bootstrapping problem—the first such compiler for a language must be compiled either by hand or by a compiler written in a different language, or (as in Hart and Levin's Lisp compiler) compiled by running the compiler in an interpreter.


Structure of a compiler:

Compilers bridge source programs in high-level languages with the underlying hardware. A compiler verifies code syntax, generates efficient object code, performs run-time organization, and formats the output according to assembler and linker conventions. A compiler consists of:

1.       The front end: Verifies syntax and semantics, and generates an intermediate representation or IR of the source code for processing by the middle-end. Performs type checking by collecting type information. Generates errors and warning, if any, in a useful way.

2.       The middle end: Performs optimizations, including removal of useless or unreachable code, discovery and propagation of constant values, relocation of computation to a less frequently executed place (e.g., out of a loop), or specialization of computation based on the context. Generates another IR for the backend.

3.       The back end: Generates the assembly code, performing register allocation in process. (Assigns processor registers for the program variables where possible.) Optimizes target code utilization of the hardware by figuring out how to keep parallel execution units busy, filling delay slots. Although most algorithms for optimization are in NP, heuristic techniques are well-developed.

One classification of compilers is by the platform on which their generated code executes. This is known as the target platform.

A native or hosted compiler is one which output is intended to directly run on the same type of computer and operating system that the compiler itself runs on. The output of a cross compiler is designed to run on a different platform. Cross compilers are often used when developing software for embedded systems that are not intended to support a software development environment.

The output of a compiler that produces code for a virtual machine (VM) may or may not be executed on the same platform as the compiler that produced it. For this reason such compilers are not usually classified as native or cross compilers.



INTERPRETER

A program that executes instructions written in a high-level language. There are two ways to run programs written in a high-level language. The most common is to compile the program; the other method is to pass the program through an interpreter.

An interpreter translates high-level instructions into an intermediate form, which it then executes. In contrast, a compiler translates high-level instructions directly into machine language. The advantage of an interpreter, however, is that it does not need to go through the compilation stage during which machine instructions are generated. This process can be time-consuming if the program is long. The interpreter, on the other hand, can immediately execute high-level programs. For this reason, interpreters are sometimes used during the development of a program, when a programmer wants to add small sections at a time and test them quickly. In addition, interpreters are often used in education because they allow students to program interactively.


COMPILER VS INTERPRETER::

A compiler differs from an interpreter, which analyzes and executes each line of source code in succession, without looking at the entire program. The advantage of interpreters is that they can execute a program immediately. Compilers require some time before an executable program emerges. However, programs produced by compilers run much faster than the same programs executed by an interpreter. Compiled programs generally run faster than interpreted programs.



Assembler

Assembler is a software or a tool that translates Assembly language to machine code. So, an assembler is a type of a compiler and the source code is written in Assembly language. Assembly is a human readable language but it typically has a one to one relationship with the corresponding machine code. Therefore an assembler is said to perform isomorphic (one to one mapping) translation. Advanced assemblers provide additional features that support program development and debugging processes.


What is the difference between an Assembler and a Compiler?

Compiler is a computer program that reads a program written in one language and translates it in to another language, while an assembler can be considered a special type of compiler which translates only Assembly language to machine code. Compilers usually produce the machine executable code directly from a high level language, but assemblers produce an object code which might have to be linked using linker programs in order to run on a machine. Because Assembly language has a one to one mapping with machine code, an assembler may be used for producing code that runs very efficiently for occasions in which performance is very important (for e.g. graphics engines, embedded systems with limited hardware resources compared to a personal computer like microwaves, washing machines, etc.).

Computer Forensics

Computer Forensics is the application of investigation and analysis techniques to gather and preserve evidence from a particular computing device in a way that is suitable for presentation in a court of law. The goal of computer forensics is to perform a structured investigation while maintaining a documented chain of evidence to find out exactly what happened on a computing device and who was responsible for it.

Forensic investigators typically follow a standard set of procedures: After physically isolating the device in question to make sure it cannot be accidentally contaminated, investigators make a digital copy of the device's storage media. Once the original media has been copied, it is locked in a safe or other secure facility to maintain its pristine condition. All investigation is done on the digital copy.

Investigators use a variety of techniques and proprietary software forensic applications to examine the copy, searching hidden folders and unallocated disk space for copies of deleted, encrypted, or damaged files. Any evidence found on the digital copy is carefully documented in a "finding report" and verified with the original in preparation for legal proceedings that involve discovery, depositions, or actual litigation.


Computer forensics has become its own area of scientific expertise, with accompanying coursework and certification.

ECHELON

Echelon is an officially unacknowledged U.S.-led global spy network that operates an automated system for the interception and relay of electronic communications. Monitored transmissions are said to include up to 3 billion communications daily, including all the telephone calls, e-mail messages, faxes, satellite transmissions, and Internet downloads of both public and private organizations and citizens worldwide. Led by the U.S. National Security Agency (NSA), Echelon is operated collaboratively by the intelligence agencies of the United States, the United Kingdom, Australia, Canada, and New Zealand. The organization's name originated as the code name for the system component responsible for intercepting satellite communications.


Echelon collects information through an extensive system of radio antennae and satellites that monitor satellite communications and sniffer devices that collect Internet communications from data packets. Some sources claim that the organization employs underwater devices to tap into transcontinental fiber optic phone cables. Echelon gathers huge volumes of data indiscriminately, and then filters out useful information through artificial intelligence (AI) technology. The system is also said to involve voice recognition, language translation, and keyword searching to select messages to study in their entirety. 

Friday, 7 March 2014

ASP and ASP.NET

ASP

(Active Server Pages) is developed by Microsoft with the extension .asp that contains a combination of HTML tags and scripts that run on a web server.


ASP.NET

Is a server-side Web application framework designed for Web development to produce dynamic Web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime(CLR), allowing programmers to write ASP.NET code using any supported .NET language. The ASP.NET SOAP extension framework allows ASP.NET components to process SOAP messages.

ASP.NET Web pages, known officially as Web Forms, are the main building blocks for application development. Web forms are contained in files with a ".aspx" extension; these files typically contain static (X)HTML markup, as well as markup defining server-side Web Controls and User Controls where the developers place all the rc content for the Web page.


What is the difference between ASP and ASP.NET?

ASP
ASP.NET
ASP does not take part in .NET development. 
ASP.NET takes part in .NET development and ASP.NET 3.0 is a replacement of ASP 3.0.
ASP is a request response model.
ASP.NET is a programming model that is event driven.
ASP code is an interpreted language that is interpreted by the script engine.
ASP.NET is a compiled CLR code that will be executed on the Server.
HTML and the coding logic are mixed in ASP.
The code and design logic is separated in ASP.NET.
To develop and debug ASP application, there are very limited tools.
ASP.NET application can be developed and debugged using various tools including the leading Visual Studio .NET tool.
ASP has limited support to Object Oriented Programming principles.
ASP.NET is a complete Object Oriented Programming language.
Session management and application state management is very limited in ASP.
ASP.NET extends complete support for session management and application state management.
Error handling system is poor in ASP.
ASP.NET offers complete error handling and exception handling services.
ASP does not offer any in-built support for the XML.
In ASP.NET, data exchange is easily performed using XML support.  
Data source support is not fully distributed in ASP.
Data source support is fully distributed in ASP.NET.


Difference Between OOP and POP

Difference Between OOP and POP




PROCEDURE ORIENTED  PROGRAMMING(POP)                   


OBJECT ORIENTED PROGRAMMING(OOP)
  • Top down approach in program design.
  • Bottom up approach in program design.
  • No access specifiers are used. Example: In structure all the members are public.
  • Public,Private,protected Access specifiers are used. Example:In class Data is Private and Functions are public.
  • Larger programs are divided into Functions.
  • Larger programs are divided into entites known as objects.
  • Most of the Functions share global data means data move openly around the system from one Function to another Function.
  • Data is private and Functions inside class can only access the private data.
  • Example of POP is C, FORTRAN.
  • Example of OOP is C++.
  • In POP operator can not be overloaded.
  • In OOP operator can be overloaded by using the concept of operator overloading.
  • Emphasis on doing algorithm means importance is given to the sequence of things to be done i.e algorithm.
  • Importance is given to the data.
  • Objects are very difficult to add in POP.
  • Objects ( i.e data and Functions ) are very easy to add at any time whenever necessary.
  • Procedural in nature.
  • Non-Procedural in nature.

DBMS MCQS

DBMS MCQS 


1. What is DBMS?
It is a collection of programs that helps the user to create and maintain a database.

2. What is database system?
 It is a combination of database and DBMS software.

3. Merits of DBMS:
  • Control redundancy.
  • Restrict unauthorized access 
  • Allow multiple user interfaces
  • Enforce integrity constraints
  • Provide backup and recovery.

4.What are the levels of  Levels of abstraction?

  1. Physical level: The lowest level abstraction that describes how data is stored.
  2. Logical level: Middle level of abstraction Which describes what data are stored and what is the relationship among the data
  3. View level: Highest level of abstraction that describes only part of the database.

5. Two types of integrity rules
  1. Entity Integrity: Primary key cannot be NULL
  2. Referential Integrity: Foreign key can either be NULL or should be a primary key of another relation.

6. What is the difference between physical data independence and logical data independence?
  1. Physical data independence: Modification in physical level should not affect logical level
  2. Logical data independence: Modification in logical level should affect view level.

7. What is SDL?
  • SDL means Storage Definition Language.
  • It specifies internal schema and also mapping between two schemas.

8. What is a DML compiler?
It helps to translate DML statements in the query language into low level instruction that is understood by the query evaluation engine.

9. What is relational algebra?
It is a procedural query language.
It is a set of operations that take one or two relations as input and produce a new relation.

10. What is transparent DBMS?
 It is the DBMS that keeps its physical structure hidden from user.

11. If a relation is in 2NF, then
Every non-prime attribute is fully functionally dependent on each relation key.

12. The data type created by data abstraction process is called as
Class

13. An entity instance is a single occurence of
An entity type

14. A relation which is in BCNF is always in which NF
3NF

15. 2-phase locking protocol suffers from...
Deadlocks

16. Time stamp protocol suffers from.....
Frequent aborts, cascading rollbacks

17. In generalization, the difference between members of an entity is
Maximized.

18. Some of the commonly used Aggregate functions are..........
SUM, AVG, COUNT

19. A locked file can be.......
* Modified by users with correct password
* Used to hide sensitive information.

Computer Science MCQ (Multiple Choice Questions)

Computer Science MCQ (Multiple Choice Questions)


Q.1)      ____________ refers to any type of application or presentation that involves more than one type of media, such as text, graphics, video, animation, and sound.
A.         An executable file
B.         Desktop publishing
C.         Multimedia
D.         Hypertext

Q.2)      One of the disadvantages of multimedia is:
A.         cost
B.         adaptability
C.         usability
D.         relativity

Q.3)      The text color in a presentation should contrast with the ________ color.
A.         CPU
B.         frame
C.         stack
D.         background

Q.4)      Images included in many software titles are called _________.
A.         clipart
B.         popups
C.         .jpg files
D.         .tiff files

Q.5)      A smaller version of an image is called a:
A.         clipart
B.         bitmap
C.         portable network graphic
D.         thumbnail

Q.6)      The process of planning your multimedia presentation is known as a:
A.         design
B.         storyboard
C.         development
D.         layout

Q.7)      In slide ______ view, you see the entire presentation displayed in miniature. This view is used to arrange the slides in your presentation, as well as, to add animations, transitions and timing.
A.         arranger
B.         creator
C.         shaper
D.         sorter

Q.8)      The slide ________ controls text characteristics, background color and special effects, such as shadowing and bullet style.
A.         presentation
B.         master
C.         show
D.         sorter

Q.9)      Designed to create a particular look, a __________ contains color schemes, slide and title masters with custom formatting and fonts styles.
A.         template
B.         presentation
C.         slide
D.         background

Q.10)    Adding _________ to objects on your slides not only controls the flow of information, but adds interest to your presentation.
A.         background
B.         transition
C.         animation
D.         popups

Q.11)    The ________ master controls the format and placement of the titles and text you type on slides, as well as, background items and graphics you want to appear on every slide.
A.         slide
B.         copyright
C.         layout
D.         design

Q.12)    The first slide in a presentation is usually reserved for the _________.
A.         introduction
B.         author
C.         master
D.         title


Q.13)    ______________ is the special effect used to introduce each slide in a slide presentation.
A.         Animation
B.         Bulleting
C.         Transition
D.         Mapping

Q.14)    Notes that include the slide as well as key comments and points you may want to emphasis while you present your slide show are know as:
A.         speaker handouts
B.         speaker notes
C.         student notes
D.         cheat sheet

Q.15)    A ________ displays a list of commands and usually appears in the toolbar at the top of the screen.
A.         view
B.         menu
C.         kit
D.         list

Q.16)    Slide and title masters contain ___________ that reserve spaces for text and footers such as date, time and slide number.
A.         reservations
B.         placeholders
C.         spaces
D.         documents

Q.17)    Changing the appearance of your slide _________ can alter the slide’s color, shade, pattern, or texture.
A.         background
B.         foreground
C.         watermark
D.         design

Q.18)    A ____________ is a series of slides displayed in a particular sequence.
A.         placeholder
B.         layout
C.         template
D.         slide show

Q.19)    Quick access to frequently used commands can be found in the ________ toolbar.
A.         view
B.         drawing
C.         kit
D.         menu

Q.20)    A ____________ can be added to your presentation and then used to go to a variety of locations ---- for example, a web address, an e-mail address, a custom show or document, just to name a few.
A.         menulink
B.         hyperlink
C.         toollink
D.         slidelink