C++ java Programmer Q1

  1. Define “Machine Language.” 
  2.  Machine language is a collection of binarydigits or bits that the computer reads and interprets. Machine language is the only language a computer is capable of understanding.

Below is an example of machine language (binary) for the text “Hello World”.

01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100

  1. Define “Assembly Language.”
  2. An assembly language is a low-level programming language for microprocessors and other programmable devices. It is not just a single language, but rather a group of languages. An assembly language implements a symbolic representation of the machine code needed to program a given CPU architecture.

An assembly language is the most basic programming language available for any processor. With assembly language, a programmer works only with operations that are implemented directly on the physical CPU.

Assembly languages generally lack high-level conveniences such as variables and functions, and they are not portable between various families of processors. They have the same structures and set of commands as machine language, but allow a programmer to use names instead of numbers. This language is still useful for programmers when speed is necessary or when they need to carry out an operation that is not possible in high-level languages

  1. Define “source code.”
  2. Source code is the list of human-readable instructions that a programmer writes—often in a word processing program—when he is developing a program. The source code is run through a compiler to turn it into machine code, also called object code, that a computer can understand and execute. Object code consists primarily of 1s and 0s, so it isn’t human-readable.
  3. Purposes of source code

    Beyond providing the foundation for software creation, source code has other important purposes, as well. For example, skilled users who have access to source code can more easily customize software installations, if needed.

 

 

  1. Define “object code.”

object code

  1. Define “library.”

library is a collection of code which you want to make available to a program or group of programs. It includes the implementation of a particular interface or set of interfaces.

Code is defined in a library to prevent code duplication and encourage re-use. A library can be statically-linked (.lib) or dynamically-linked (.dll):

  • statically-linked library defines a set of export symbols (which can be thought of as method definitions) which are then linked into the final executable (.exe) during the linking stage of the build process. It has the advantage of faster execution time (as the library doesn’t need to be dynamically loaded), at the expense of a larger binary (because the methods are essentially replicated in the executable file).
  • dynamically-linked library is linked during the execution of a program, rather than the linking of a program. It is useful when multiple programs need to re-use the same methods, and is used extensively in technologies such as COM.
  1. Define “linker.”

Linking refers to the creation of a single executable file from multiple object files. In this step, it is common that the linker will complain about undefined functions (commonly, main itself). During compilation, if the compiler could not find the definition for a particular function, it would just assume that the function was defined in another file. If this isn’t the case, there’s no way the compiler would know — it doesn’t look at the contents of more than one file at a time. The linker, on the other hand, may look at multiple files and try to find references for the functions that weren’t mentioned.

You might ask why there are separate compilation and linking steps. First, it’s probably easier to implement things that way. The compiler does its thing, and the linker does its thing — by keeping the functions separate, the complexity of the program is reduced. Another (more obvious) advantage is that this allows the creation of large programs without having to redo the compilation step every time a file is changed. Instead, using so called “conditional compilation”, it is necessary to compile only those source files that have changed; for the rest, the object files are sufficient input for the linker. Finally, this makes it simple to implement libraries of pre-compiled code: just create object files and link them just like any other object file. (The fact that each file is compiled separately from information contained in other files, incidentally, is called the “separate compilation model”.)

  1. Define “executable program.”

In computers, to execute a program is to run the program in the computer, and, by implication, to start it to run. In usage, people run programs and systems execute them. That is, a system user asks the system to run the program (or sets it up so that this happens automatically at a certain time) and, as a result, the system executes the program. Typically, we don’t say that a program is executing; we say that it is running.

in short –A computer file containing a program, or part of a program, that is capable of being executed in its current format.

  1. How is assembly language different from machine language?
  2. What does a compiler do?
  3. How is a compiler different from an assembler?
  4. What is the extension of source files on our machine?
  5. What type of program is used to create “source code.”
  6. What is the extension of object files on our machine?
  7. What type of programs are used to produce object files?
  8. What is the extension of the executable programs?
  9. What type of files goes into creating an executable program?
  10. What type of program is used to create an executable program
  11. How do you access the online help system for your compiler?
  12. What is the difference between a simple #define macro and a const declaration?
  13. When would you use conditional compilation?
  14. What is the difference between a parameterized macro and a simple macro?
  15. What is the difference between a macro and a normal function