Sie sind auf Seite 1von 5

1 Difference between Compiler and Interpreter

N
o

Compiler

Interpreter

Compiler Takes Entire program as


input

Interpreter
Takes Single instruction as input .

Intermediate
isGenerated

No Intermediate
isGenerated

Conditional Control
are Executes faster

Memory
Requirement : More(Since Object
Code is Generated)

Memory Requirement is Less

Program
need
be compiledevery time

Every time higher level program is


converted
into
lower
level
program

Errors are displayed after entire


program is checked

Errors are displayed for every


instruction interpreted (if any)

Example : C Compiler

Example : BASIC

Object

Code

Statements

not

Object

Code

Conditional Control Statements


are Executes slower

2
What is a class in c# net?
Classes (C# Programming Guide) A class is a construct that enables you to create your own
custom types by grouping together variables of other types, methods and events. A class is like
a blueprint. It defines the data and behavior of a type.
Classes (C# Programming Guide) - MSDN - Microsoft
https://msdn.microsoft.com/en-us/library/x9afc042.aspx
Search for: What is a class in c# net?

What is a class?

In object-oriented programming, a class is an extensible program-code-template for creating


objects, providing initial values for state (member variables) and implementations of behavior
(member functions or methods).
Class (computer programming) - Wikipedia, the free ..
https://en.wikipedia.org/wiki/Class_(computer_programming)
Search for: What is a class?

What is an object in C#?


An object is basically a block of memory that has been allocated and configured according to
the blueprint. A program may create manyobjects of the same class. Objects are also called
instances, and they can be stored in either a named variable or in an array or collection.

3
What is a Constructor in Object Oriented Programming?
Constructor is specialized method that is contained in a class. Constructor will be triggered automatically
when an object is created. Purpose of the Constructors is to initialize an object of a class.
Constructors name is identical to the Class name. Constructors can take parameters but constructors
have no return type. This is because; constructors return an object by itself.
Here is a code sample showing creation of constructor:

public class Person {

int studentId;

String name;

public Person(int studentId, String name) //Constructor creation

this.studentId = studentId;

this.name = name;

public class MainApplication {

public static void main(String args[])

Person p1;

p1 = new Person(123,John); //Constructor Call

Time complexity
How long does this sorting program run? It possibly takes a very long time on large inputs (that is
many strings) until the program has completed its work and gives a sign of life again. Sometimes it
makes sense to be able to estimate the running time before starting a program. Nobody wants to
wait for a sorted phone book for years! Obviously, the running time depends on the number n of the
strings to be sorted. Can we find a formula for the running time which depends on n?
Having a close look at the program we notice that it consists of two nested for-loops. In both loops
the variables run from 0 to n, but the inner variable starts right from where the outer one just stands.
An if with a comparison and some assignments not necessarily executed reside inside the two
loops. A good measure for the running time is the number of executed comparisons. [11] In the first
iteration n comparisons take place, in the second n-1, then n-2, then n-3 etc. So 1+2+...+n
comparisons are performed altogether. According to the well known Gaussian sum formula these are
exactly 1/2(n-1)n comparisons. Figure 2.8 illustrates this. The screened area corresponds to the
number of comparisons executed. It apparently corresponds approx. to half of the area of a square
with a side length of n. So it amounts to approx.1/2n2.
Figure 2.8. Running time analysis of sorting by minimum search

Space complexity
The better the time complexity of an algorithm is, the faster the algorithm will carry out his work in
practice. Apart from time complexity, its space complexity is also important: This is essentially the
number of memory cells which an algorithm needs. A good algorithm keeps this number as small as
possible, too.
There is often a time-space-tradeoff involved in a problem, that is, it cannot be solved with few
computing time and low memory consumption. One then has to make a compromise and to
exchange computing time for memory consumption or vice versa, depending on which algorithm one
chooses and how one parameterizes it.

When an application is running, it is called runtime. The terms "runtime" and "compile time"
are often used by programmers to refer to different types of errors. A compile time error is
a problem such as a syntax error or missing file reference that prevents the program
from successfully compiling.
Now when you just use the terms runtime and compile time, the first thing that comes to
mind are the compile time errors and runtime errors:

Compile time errors: When we feed a bunch of text to the compiler to convert it to machine
code.

Das könnte Ihnen auch gefallen