2nd Year NotesComputer class 12th

2nd year Chapter 8 Getting Started With C

2nd year Chapter 8 Getting Started With C Question And Answer

Short And Simple Question And Answer

Q 1. What is a computer program?

Ans. A computer program is a set of instructions used to solve specific problems, written in programming languages.

Q 2. What is a programming language?

Ans. A programming language is a means of communication with computers, using a set of rules and alphabets to write computer programs.

Q 3. List different types of programming languages.

Ans. There are two types of programming languages: low-level languages and high-level languages.

Q 4. What is a high-level language?

Ans. A high-level language is one that resembles human language, making it easy to understand and learn, with instructions resembling English sentences.

Q 5. What is a low-level language?

Ans. A low-level language is one closely related to the language of computers, including machine language and assembly language.

Q 6. What is machine language?

Ans. Machine language, also known as binary language, uses only 0s and 1s as its alphabet. It is the native language of computers.

Q 7. What is assembly language?

Ans. Assembly language replaces machine language instructions with English-like words (mnemonics). It is easier to write and is often used for system software.

Q 7. What is a source program?

Ans. A source program is a computer program written in a high-level language, also referred to as source code.

Q 8. What is an object program?

Ans. An object program is a computer program written in machine language, also known as object code, which can be directly executed by the computer.

Q 9. What is a language translator?

Ans. A language processor is software that converts programs written in various programming languages into machine language. It includes compilers and interpreters.

Q 10. What is a compiler?

Ans. A compiler is software that translates high-level language programs into machine language. It checks for errors and produces an executable file.

Q 11. What is an interpreter?

Ans. An interpreter is a program that translates a source program into an object program one statement at a time, executing each statement immediately after translation.

Q 12. What is an assembler?

Ans. An assembler is a language translator that converts programs written in assembly language into machine language.

Q 13. What is a structured programming language?

Ans. In structured programming languages, programs are divided into modules or parts, making them easy to write and debug, with fewer chances of errors.

Q 14. What is an unstructured programming language?

Ans. Unstructured programming languages do not use modules or parts in the program, making them harder to write and debug with a higher chance of errors.

Q 15. What is a preprocessor?

Ans. A preprocessor is a program that modifies C programs before compilation, processing preprocessor directives and macros.

Q 16. What is a preprocessor directive?

Ans. Preprocessor directives are instructions for the preprocessor, starting with a # symbol, such as #include for including header files and #define for defining constants.

Q 17. What is the work of include directive?

Ans. The include directive is used to include header files in a program, especially those related to library functions.

Q 18. What is the work of define directive?

Ans. The define directive is used to define constant macros in a program, allowing the creation of symbolic names for values or expressions.

#define Macro-Name expression

Q 19. What is a statement terminator?

Ans. Every C language statement ends with a semicolon “;”. Semicolon at the end of a statement is called a statement terminator.

Q 20. What are delimiters?

Ans. Curly braces at the beginning and end of the main function are called delimiters. C language statements are written between delimiters.

Q 21. What is the main function?

Ans. Every C language program must contain a main() function. A program without the main function cannot be executed. Instructions of programs are written between the curly braces {} of the main() function. These statements enclosed in the main() function are called the body of the main() function.

Q 22. What are bugs and debugging?

Ans. While writing a program, the programmer may come across many errors. The error in a program is called a bug. The process of finding and removing errors is called debugging.

Q 23. What is meant by creating a program?

Ans. Writing source code statements is called creating a C program. Turbo C IDE can be used to create and edit the program. First, open Turbo C IDE, then select “new” from the file menu. A new edit window will be opened. The cursor blinks in the window. You can write the program statements in the window and save it as a program file.

Q 24. What is meant by editing a program?

Ans. Writing and editing the source program is the first step. Source code is written in C language according to the type of the problem in any text editor. Changing the source code and removing errors in the program is called editing a program.

Q 25. What is meant by compiling a program?

Ans. Computers do not understand C language; they understand only machine language. So, C language code is converted into machine language. The process of converting source code into machine code is called compiling. Compiler is a program that compiles source code. If compiling is successful, the source program is converted into an object program. The object program is saved on disk, and the file has the extension “.obj.”

Q 26. What is meant by linking a program?

Ans. The process of combining required library functions with the object program is called linking. This is done with the help of a program called a linker. The linker combines the object program produced by the compiler and library functions, producing a final machine language file. This file is called an executable file, and it has the extension “.exe.”

Q 27. What is meant by executing a program?

Ans. The process of running an executable file is called executing. After linking, a C program can be executed. A program loader is used to transfer the executable file from secondary storage to main memory. The program can be executed by selecting “run” from the run menu bar of Turbo C IDE or by pressing Ctrl + F9 keys on the keyboard.

Q 28. List names of some high-level languages.

Ans. High-level languages include:

  • C
  • C++
  • C#
  • JAVA

Q 29. What is Turbo C++?

Ans. Turbo C++ is an Integrated Development Environment (IDE) for creating C and C++ programs, developed by Borland International. It is used for creating, editing, saving, compiling, linking, and executing programs. It also has powerful debugging features to find and remove errors from programs.

Q 30. What are the necessary steps to prepare a C program?

Ans. The steps to prepare a C program are:

  1. Creating & Editing
  2. Saving
  3. Compiling
  4. Linking
  5. Loading
  6. Running

Q 31. What are header files?

Ans. Header files are part of a C compiler and provide access to library functions. C language has many built-in library functions, each performing a specific task. These functions are organized into groups based on functionality, and each group is stored in a separate file called a header file.

Q 32. What is a C statement?

Ans. Every instruction written in a C language program is called a C statement. Each statement ends with a semicolon “;,” which is referred to as a statement terminator.

Q 33. What are syntax errors?

Ans. Syntax errors occur when program statements do not follow the specific rules (syntax) of the C language. These errors are detected by the compiler. They are typically related to incorrect formatting or misuse of C language constructs.

Q 34. What are logical errors?

Ans. Logical errors occur when the program’s algorithm is incorrect, leading to incorrect results. Compiler cannot detect these errors. A program with logical errors runs but produces inaccurate output. Finding and fixing logical errors requires careful examination of the program.

Q 35. What are runtime errors?

Ans. Runtime errors occur during program execution and are typically caused by attempts to perform tasks that the computer cannot handle. These errors stop program execution and display error messages.

Q 36. What is ANSI C?

Ans. ANSI C, or American National Standard Institute C, is a standardized version of the C programming language developed in the late 1980s. It introduced new features and provided a standard for C language development.

Q 37. List any four advantages of C language.

Ans. Advantages of C language include:

  1. Easy to learn
  2. Easy to remove errors
  3. Machine independence
  4. Standard syntax
  5. Shorter programs

Q 38. What is meant by machine independence?

Ans. A program written in a high-level language, like C, is machine-independent. It can run on different types of computers without modification.

Q 39. What is the difference between a compiler and an interpreter?

Ans. A compiler is a program that translates an entire high-level language program into machine language as a whole. It compiles the source code into an object program that can be executed. In contrast, an interpreter converts the source program into an object program one statement at a time, executing each statement after translation. Interpreters are used for languages that need to be compiled and executed immediately, without creating a separate object file.

Related Articles

Check Also
Back to top button
Enable Notifications OK No thanks