Thursday, 29 September 2011

11 Major Differences Between C And C++

C++, as the name suggests is a superset of C. As a matter of fact, C++ can run most of C code while C cannot run C++ code. Here are the 10 major differences between C++ & C…

1. C follows the procedural programming paradigm while C++ is a multi-paradigmlanguage(procedural as well as object oriented)

In case of C, importance is given to the steps or procedure of the program while C++ focuses on the data rather than the process.
Also, it is easier to implement/edit the code in case of C++ for the same reason.



2. In case of C, the data is not secured while the data is secured(hidden) in C++

This difference is due to specific OOP features like Data Hiding which are not present in C.


3. C is a low-level language while C++ is a middle-level language (Relatively, Please see the discussion at the end of the post)

 C is regarded as a low-level language(difficult interpretation & less user friendly) while C++ has features of both low-level(concentration on whats going on in the machine hardware) & high-level languages(concentration on the program itself) & hence is regarded as a middle-level language.



4. C uses the top-down approach while C++ uses the bottom-up approach

In case of C, the program is formulated step by step, each step is processed into detail while in C++, the base elements are first formulated which then are linked together to give rise to larger systems.



5. C is function-driven while C++ is object-driven

 Functions are the building blocks of a C program while objects are building blocks of a C++ program.


6. C++ supports function overloading while C does not
 

Overloading means two functions having the same name in the same program. This can be done only in C++ with the help of Polymorphism(an OOP feature)



7. We can use functions inside structures in C++ but not in C.

In case of C++, functions can be used inside a structure while structures cannot contain functions in C.



8. The NAMESPACE feature in C++ is absent in case of C

 C++ uses NAMESPACE which avoid name collisions. For instance, two students enrolled in the same university cannot have the same roll number while two students in different universities might have the same roll number. The universities are two different namespace & hence contain the same roll number(identifier) but the same university(one namespace) cannot have two students with the same roll number(identifier)



9. The standard input & output functions differ in the two languages

C uses scanf & printf while C++ uses cin>> & cout<< as their respective input & output functions



10. C++ allows the use of reference variables while C does not

Reference variables allow two variable names to point to the same memory location. We cannot use these variables in C programming.



11. C++ supports Exception Handling while C does not.

C does not support it “formally” but it can always be implemented by other methods. Though you don’t have the framework to throw & catch exceptions as in C++.
10 Reasons - Why C Should be your First Programming Language

In this dynamic IT world new language come every day and get obsolete, so there must be something in the C which has remained there for 3 decades and more and even today there is hardly any language which can match its strength.

90% of the starting programmer says that C has been superseded by its predecessors such as C++, Java, and C # and so on so why learn C. I don't know why they think so but I know one thing that they will never excel the other 10% programmers who differs from this opinion. Simple reason is how could a skyscraper(continuously habitable building of many stories) building stand against time if its foundation is not strong.

C was the programming language developed at AT & T's Bell Laboratories of USA in 1972. It was written by a man name Dennis Ritchie.

Now Let us begin to analyze reason why C should be your first programming language.

1.I believe nobody can learn C++ or Java directly. To master these languages you need to have a strong concept of programming element such as polymorphism, classes, inheritance etc. Simple question is how you can learn such complicated concepts when you don't even know about the basic elements such as block functions. C is a language which begins from scratch and it has foundational concepts on which today concepts stand on.

2.It is language on which C++ is based on, hence C# also derive its origin from the C. Java is also a distant cousin of C and share the same programming concept and syntax of C. These are the most dominant languages in the world and all are based on C. To rock the world through them you must get rocking with C.

3.C++, Java, and C # make use of OOP (Object Oriented Programming). Not all programs need it even though it is a powerful tool. Such programs are still written in C.

4. When ever it comes to performance (speed of execution), C is unbeatable.

5.Major parts of the Windows, Unix and Linux are still written in C. So if you want program these OS or create your own you need to know C.

6.Device drivers of new devices are always written in C. The reason is that C provides you access to the basic elements of the computer. It gives you direct access to memory of your CPU through pointers. It allows you to manipulate and play with bits and bytes.

7.Mobiles, Palmtops, PDA's etc are gaining popularity every second. Also appliances such as T.V., Refrigerators, and Microwaves etc. are becoming an integral part of our daily needs. You may not know but they have a CPU with them which do need programming and the software's written for them are known as embedded system programs. These programs have to be fast in execution but also have a very little memory. No question why C is ideally suited for embedded system programming.

8.You must have played games on your PC. Even today these astounding 3D games use C as their core. Why? The simple reason who will play the game when it takes a lot of time fire a bullet after you have given command from the console. The reply to the command should be damn prompt and fast. Reply in 1 Nano second is an outstanding game; Reply in 10 Nano seconds is crap. Even today there is no match for C.

9. C is a middle level language. There are three types of language - High Level, Middle Level & Low Level. High level languages are user oriented, giving faster development of programs, example is BASIC. Low level languages are machine oriented; they provide faster execution of programs. C is a middle level language because it combines the best part of high level language with low level language. It is both user and machine oriented and provides infinite possibilities.

10.Last but not least it is a block structured language. The first symbol of a modern language is that it is block structured. Each code exists in separate block and is not known to code in other block providing easy means of programming and minimizing the possibilities of undesirable side effects. C is designed from the base to top to be a block structured language. Many older languages, most popular being BASIC tried to introduce this concept but their short coming can never fulfilled as they were never built along these line.

I think I have given all reason I know why c should be your first programming language. One thing is for sure that there no other language which more reliable, simple and easy to use.
About Computer Programming:


Computer programming is at the core of any computer operation. Unlike usual electro mechanical devices, a computer requires software to carry out instructions. At the lowest level, machine code is used to control the hardware and operations of a computer. The machine language is a set of zeros and ones and rather tedious to handle. Therefore the instructions are coded in a higher level language called a computer program. The conversion of a higher level language into a machine code is carried out by assembly level languages or assemblers. The transformation is completed without any human interface.

During the initial days when computer programs were still at a nascent stage of development, languages such as COBOL and BASIC were highly popular. As the computing power of computers increased ,the demand for more efficient programs emerged. The third generation programs had better portability and efficiency compared to the earlier generations. The need to handle enormous amount of data gave rise to specialized software called database management software or more specifically relational database management software. Companies like Oracle, IBM and Microsoft have developed their own version of RDBMS. On the processing front ,Mainframes were using COLOL for business applications and FORTRAN ( Formula Translation ) for scientific applications.

The concept of modularity became popular when hundreds of software programmers worked simultaneously on a single large project. Object oriented programs like C++ gathered popularity. The code used in these higher level languages was reusable and the techniques could provide for better efficiency.

Microsoft meanwhile brought out its own operating system which could be used on personal computers. In a matter of years the Windows OS became a unprecedented success. The OS2 operating system used by Apple computers was relegated to a second position. IBM has been providing other system software but none could reach the popularity levels of Windows. The only problem with Windows is the issue of security breaches. Though Microsoft has been striving hard to plug the security holes, it has not been entirely successful.

Modern computer programs strive more and more to behave like human language. Technologists believe that a day would come when one could program a computer by given verbal instructions. Surely that's not going to happen in a hurry. Artificial intelligence, expert systems, fuzzy logic and many more state of the art technologies are changing the face of programming.

Computers unlike any other machine require a software program to operate. It speaks in machine language which is gibberish to the human mind. Higher level languages are used to translate recognizable instructions into machine language. As we progress, the higher level languages would resemble human languages.

At the beginning of the computer era, a single program used to execute different functions. Today, specialized programs are tailor made for different applications. Complex programs require many programmers to work simultaneously on a single project. Modular languages are well suited for such large projects. Object oriented programming has become popular due to their modularity and ease of use.


Wednesday, 28 September 2011

What is the Difference Between http and https?

Hypertext Transfer Protocol (http) is a system for transmitting and receiving information across the Internet. Http serves as a request and response procedure that all agents on the Internet follow so that information can be rapidly, easily, and accurately disseminated between servers, which hold information, and clients, who are trying to access it. Http is commonly used to access html pages, but other resources can be utilized as well through http. In many cases, clients may be exchanging confidential information with a server, which needs to be secured in order to prevent unauthorized access. For this reason, https, or secure http, was developed by Netscape corporation to allow authorization and secured transactions.

In many ways, https is identical to http, because it follows the same basic protocols. The http or https client, such as a Web browser, establishes a connection to a server on a standard port. When a server receives a request, it returns a status and a message, which may contain the requested information or indicate an error if part of the process malfunctioned. Both systems use the same Uniform Resource Identifier (URI) scheme, so that resources can be universally identified. Use of https in a URI scheme rather than http indicates that an encryptedconnection is desired.
There are some primary differences between http and https, however, beginning with the default port, which is 80 for http and 443 for https. Https works by transmitting normal http interactions through an encrypted system, so that in theory, the information cannot be accessed by any party other than the client and end server. There are two common types ofencryption layers: Transport Layer Security (TLS) and Secure Sockets Layer (SSL), both of which encode the data records being exchanged.

When using an https connection, the server responds to the initial connection by offering a list of encryption methods it supports. In response, the client selects a connection method, and the client and server exchange certificates to authenticate their identities. After this is done, both parties exchange the encrypted information after ensuring that both are using the same key, and the connection is closed. In order to host https connections, a server must have apublic key certificate, which embeds key information with a verification of the key owner's identity. Most certificates are verified by a third party so that clients are assured that the key is secure.

Https is used in many situations, such as log-in pages for banking, forms, corporate log ons, and other applications in which data needs to be secure. However, if not implemented properly, https is not infallible, and therefore it is extremely important for end users to be wary about accepting questionable certificates and cautious with their personal information while using the Internet.

Friday, 23 September 2011

JAVA QUESTIONS




Java is not 100% pure object oriented programming language

1 It use primitive data type like int,char,float etc.
2 Here in this program no object use:
class Test
{
static
{
System.out.println("Hi!!!");
}
}

The above code does not use any object to show the output, so that java is not 100% Object Oriented Language because it is not using any object...!!!

but we can say it almost pure OOP language.



Java is not pure object oriented language, because in object oriented concept every method is called throw its objects.In java main()is also a method, but without creating object we accessing main method..."General think"
By using the key word static we can access any method without creating object...so java its not pure object oriented language.



 "Primitive data types can't be referenced as memory addresses.
 That's why we need wrappers which serve as placeholders for primitive values".











Q .How will you convert a String array to an ArrayList object?


String[] stringArray = new String[] {"x", "y", "Z"};
List list = Arrays.asList(stringArray);


Q.What's the difference between a queue and a stack?


Stacks works by last-in-first-out rule (LIFO), while queues use the FIFO rule.


Q.You are planning to do an indexed search in a list of objects. Which of the two Java collections should you use: ArrayList or LinkedList?

ArrayList.


Q.How do you know if an explicit object casting is needed?
In order to assign a superclass object to a variable of a subclass,one needs to do explicit casting. For example:

Person person;
Man man;
man = (Man)person;

While automatic casting happens when you typecast a subclass object as parent class object.






Q.What's the difference between the methods sleep() and wait() ?

 The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread.

Wednesday, 21 September 2011



VHDL 
(VHSIC hardware description language) is a hardware description language used in electronic design automation to describe digital and mixed-signal systems such as field-programmable gate arrays and integrated circuits.

Note: VHSIC stands for very-high-speed integrated circuits.


Design
VHDL is commonly used to write text models that describe a logic circuit. Such a model is processed by a synthesis program, only if it is part of the logic design. A simulation program is used to test the logic design using simulation models to represent the logic circuits that interface to the design. This collection of simulation models is commonly called a testbench.

VHDL has constructs to handle the parallelism inherent in hardware designs, but these constructs (processes) differ in syntax from the parallel constructs in Ada (tasks). Like Ada, VHDL is strongly typed and is not case sensitive. In order to directly represent operations which are common in hardware, there are many features of VHDL which are not found in Ada, such as an extended set of Boolean operators including nand and nor. VHDL also allows arrays to be indexed in either ascending or descending direction; both conventions are used in hardware, whereas in Ada and most programming languages only ascending indexing is available.

VHDL has file input and output capabilities, and can be used as a general-purpose language for text processing, but files are more commonly used by a simulation testbench for stimulus or verification data. There are some VHDL compilers which build executable binaries. In this case, it might be possible to use VHDL to write a testbench to verify the functionality of the design using files on the host computer to define stimuli, to interact with the user, and to compare results with those expected.

Tuesday, 20 September 2011

Some Concept's Keep In you Mind


The main() Function in C/C++

The main function in a C++ program can have either of the following signatures:

return-type main()
return-type main(int argc, char *argv[])

The return-type can be any valid type or void indicating that the function does not return any value. The argument list can be empty, or can contain the arguments shown to support the use of command-line arguments.

The argument int argc is used by the operating system to pass an integer value specifying the number of command-line arguments entered by the user.

The argument char *argv[] passes a pointer to an array of pointers of type char. Each of the pointers in the array points to a null-terminated string in memory, which is an argument, entered at the command line. The pointer with an index of 0 points to a string containing the name of the program (or garbage with some systems). The pointer with an index of 1 points to the first true command-line argument.

The names of the arguments shown are traditional, but not required.




Java Coding standerd follow by the sun:(Noman cleture)

Package name ,it should be in lower case.

Class name ,Interface name should have first latter in upper case and every word start with Upper case latter.

Variable name & Method name should begin with lower case but after first latter of every word is upper case.

Class constant is in upper case.

When passing variable in a method then variable name should start with a "a".