Programming Fundamentals Questions & Answers
Q2: Give Short Answers to the Following Questions
i. Differentiate between Program Syntax and Program Semantics
Program Syntax refers to the rules that define the structure of a program, such as grammar, symbols, and format. Program Semantics deals with the meaning of the program, ensuring that it produces the correct output based on the syntax.
ii. Differentiate between Low-Level & High-Level Languages
Low-Level Languages are closer to machine language and are difficult for humans to understand. High-Level Languages are closer to human language, making them easier to read and write.
iii. What is IDE?
IDE stands for Integrated Development Environment, a software suite that consolidates basic tools required for software development, including a code editor, compiler, debugger, and build automation tools.
iv. What is OOP?
OOP, or Object-Oriented Programming, is a programming paradigm that uses objects and classes to organize and structure software programs. It allows for modular, reusable, and maintainable code.
v. What are the Characteristics of High-Level Language?
High-level languages are user-friendly, portable, easier to debug, machine-independent, and allow for faster software development.
vi. Differentiate between Compiler & Interpreter
A Compiler translates the entire source code into machine code at once, while an Interpreter translates and executes code line by line.
vii. What is a Header File?
A Header File contains declarations of functions and macros that are used in multiple source files. In C/C++, header files typically have a .h
extension.
viii. Differentiate between Source Program and Object Program
A Source Program is written in a high-level programming language. After compilation, it becomes an Object Program, which is the machine code executable by the computer.
ix. What are Reserved Words?
Reserved Words are keywords in a programming language that have a specific meaning and cannot be used for any other purpose, such as variable names. Examples include if
, else
, while
, etc.
x. Write Rules for Variable Names
Variable names must begin with a letter or underscore, cannot contain spaces, should not be a reserved word, and are case-sensitive.
xi. What is the Purpose of const Qualifier?
The const qualifier is used to declare variables whose value cannot be changed once assigned, ensuring that the variable remains constant throughout the program.
Q3: What is Programming Language? Explain Different Types of Low-Level Languages.
A Programming Language is a formal language comprising a set of instructions that produce various kinds of output. Low-level languages include Machine Language, which is directly understood by the computer, and Assembly Language, which uses mnemonics and is slightly easier for humans to work with.
Q4: What are High-Level Languages? Explain Any Five Types of High-Level Languages.
High-Level Languages are programming languages that are closer to human language and easier to code, debug, and maintain. Five types include:
- Python: Known for its simplicity and readability.
- Java: Widely used in enterprise environments and for Android development.
- C++: Combines the features of high-level and low-level languages.
- JavaScript: Mainly used for web development to create interactive elements.
- Ruby: Known for its elegance and ease of use, often used in web applications.
Q5: What is the Basic Structure of C-Program? Also Explain Different Types of Preprocessor Directives.
The basic structure of a C program includes Header Files, Main Function, Variable Declarations, Statements & Expressions, and Return Statement. Preprocessor directives like #include
and #define
are used to include files and define constants, respectively.
Q6: What is Source Program? How It is Converted into Object Program?
A Source Program is the original code written by a programmer in a high-level language. This code is then compiled by a Compiler, which converts it into an Object Program—the machine-readable code.
Q7: What is Algorithm? Write an Algorithm for Making Tea.
An Algorithm is a step-by-step procedure for solving a problem. The algorithm for making tea:
- Boil water.
- Add tea leaves or tea bag to the boiling water.
- Allow it to steep for 3-5 minutes.
- Add sugar and milk to taste.
- Strain the tea into a cup and serve.