10th Computer Notes Chapter 2
Ans. A computer program is a set of instructions (statements) written in a programming language to solve a particular problem and achieve specific results. Each statement of a programming language has syntax and semantics.
Ans.
Syntax
Syntax refers to the rules of a programming language according to which statements of a program are to be written. It describes the way to write correct statements in a program.
Semantic
Semantic gives meaning to statements of a programming language. It describes the sequence of operations to be performed by a computer when executing the statements of a computer program.
Ans
Ans: High-level languages have the following characteristics.
Ans. INTEGRATED DEVELOPMENT ENVIRONMENT
An Integrated Development Environment (IDE) is used to create, compile and run programs. IDE is computer software that brings all the processes and tools required for program development into one place. IDE’s aim is to make the lives of programmers easier by grouping together all the tasks needed for building applications into one environment.
Ans. Constants are quantities whose values do not change during program execution. They may be numeric, character, or string.
A variable is a symbolic name that represents a value that can change during a program. A variable has a name, known as the variable name and it holds data of other numbers or any other type of data held in a variable is called its value.
area, 5x, Sum, net pay, float, _age, else, case, size22, my_weight
Ans: The following are the valid C variables:
Area, Sum, _age, size22, my_weight
The following are not valid C variables:
5x cannot begin with a digit
net pay Blank Space is not allowed
float cannot use reserve word
else cannot use reserve word
case cannot use reserve word
Ans. The words that are part of programming language and have special purposes in computer programs are called reserved words or keywords. They have predefined uses and cannot be used for any other purpose. Reserved words are always written in lowercase. There are 32 words defined as reserved words in C.
Ans. It is good programming practice to add comments to the program to make it easy for others to understand it. Comments in the source code are ignored by the compiler. Comments are added in programs when a fact is necessary to be brought to the attention of the program’s reader.
Ans: C language contains a number of standard functions in library files that perform various tasks in C programs. These tasks include all the input/output operations and all the main operations. Library file contains header files and each header file contains a set of functions. Some commonly used header files are stdio.h, conio.h and math.h.
C language was developed in the early 1970s by Dennis Ritchie at Bell Laboratories become one of the most popular programming languages today. It is a highly structured programming language that is easy to understand and use.
C++ was developed by Bjarne Stroustrup also at Bell Laboratories during 1 983-1985. C++ is a superset of C, meaning that any valid c program is also a valid C++ program. The purpose of developing C++ was to provide programming facilities to easily and quickly write more powerful programs.
Visual Basic (VB) is a high-level language that evolved from the earlier version called BASIC. BASIC stands for Beginner’s: All-purpose Symbolic Instruction Code. VB Is a Very popular programming language for writing Windows and Web applications.
C# (pronounced as C-sharp) is a language developed in 2000 by Microsoft Corporation. It is a simple, modern, general-purpose programming language. The syntax of C# is very similar to C and C++. It also has some features of Java. It is a language that makes computer programming easy and efficient.
Java is a high-level language developed by Sun Microsystems. It is very similar in syntax to C and C++. In Java, the user can write all types of programs as those written in other programming languages and small programs that can be embedded in a Web page accessed through the Internet. Java is an ideal language for network computing.
Ans: IDE
An Integrated Development Environment (IDE) is used to create, compile and run programs. IDE is computer software that brings all the processes and tools required for program development into one place. IDE’s aim is to make the life of programmers easier by grouping together all the tasks needed for building applications into one environment.
A C language IDE consists of the following modules
A text editor is a simple word processor that is used to create and edit the source code of a program. Files created by a text editor are plain text files. Most editors automatically highlight compile errors by simply removing them.
A compiler is computer software that translates a source program into an object program. The source program consists of statements written in a high-level language. When a source program is translated with a compiler into machine language, the resulting program is known as an object program.
A linker is software that translates an object program into a single executable program. During this process, if it couldn’t find the definition of a particular function used in the program, then it would assume that it is defined in the C library. It will replace this function in the object program with the code from the C library and then create a single executable program.
It is software that loads programs into memory and then executes them.
It is software that executes a program line by line, examines the values stored in variables, and helps find and remove errors in the program.
Ans. RULES FOR SPECIFYING VARIABLE NAMES
The following are the rules for specifying variable names in C language.
Ans:
Pre-processor directives are instructions for the C compiler. Every C language program contains certain pre-processor directives at the beginning of the program. Before translating a C language program into machine language, the compiler of C language carries out the processor directives. These directives start with the number sign (#). The most commonly used pre-processor directives are #include and #define.
It has the following syntax:
#include<header file name>
When the C compiler runs the pre-processor, it looks for the header file inside the less than (<) and greater than (>) symbols and copies it into the source file.
A compiler is computer software that translates a source program into an object program. The source program consists of statements written in a high-level language. When a source program is translated with a compiler into machine language, the resulting program is known as an object program.
An interpreter translates high-level language programs into machine language but it translates one instruction at a time and executes it immediately before translating the next instruction. Examples of programming languages that use interpreters are JavaScript, BASIC, Visual Basic, and Perl.
An interpreter reads each statement of the source program one at a time. It means each time a statement is read, it must be translated into machine language before execution. A compiler translates the entire program into an object program before execution by a computer. Therefore, a compiled program runs fast.
i. What defines the rules of valid statements in programming?
A. Compiler
B. Interpreter
C. Syntax
D. Semantic
ii. Which language is directly understood by the computer?
A. Machine language
B. Assembly language
C. High-level language
D. C language
iii. When was C language developed?
A. Late 1960s
B. Early 1970s
C. 1980s
D. 1990s
iv. Who developed Java language?
A. Dennis Ritchie
B. Microsoft
C. Sun Microsystems
D. IBM
v. What is the other word used for Reserved Words?
A. Compiler words
B. Keywords
C. Special programming words
D. Mnemonics
vi. How many bytes are set aside by the compiler for a variable of type int?
A. 2
B. 3
C. 4
D. 5
vii. How many bytes are set aside by the compiler for a variable of type float?
A. 2
B. 3
C. 4
D. 5
viii. What is the range of numbers that can be stored in a variable of type double float?
A. -32,768 ~ +32 767
B. 10-38 ~ 1038
C. 10-308~ 10308
D. 10-4932 ~ 104932
ix. Which program translates high-level language into machine language?
A. Compiler
B. Linker
C. Loader
D. Debugger
x. Which software helps in finding and removing errors in programs?
A. linker
B. Text Editor
C. Loader
D. Debugger
Unit 8: Entrepreneurship in Digital Age Write answers of the following short response questions. Q.1.…
Unit 7: Digital Literacy Write answers of the following short response questions. Q.1. Differentiate between…
Unit 6: Impacts of Computing Write answers to the following short response questions. Q1. List…
Unit 5: Applications of Computer Science Write answers of the following short response questions. Q1.…
10th Computer Science Unit 4 Data and Analysis Write answers of the following short response…
10th Computer Unit 3: Programming Fundamentals Unit 3: Programming Fundamentals Write answers of the following…