Class Matric Part 2 NotesComputer class 10th

10th class computer science chapter 1 introduction to programming

10th class computer science chapter 1 introduction to programming on newsongoogle.com by Bilal Articles

Shorts and Simple Question & Answer

Q.1: Define computer program.
Ans.
The set of instructions given to the computer are known as a computer program or Software.


Q.2: What is computer programming?
Ans.
The process of feeding or storing these instructions in the computer is known as computer programming.


Q.3: Who is programmer?
Ans.
The person who knows how to write a computer program correctly is known as a programmer.


Q.4: Who and when C language was developed?
Ans.
C language was developed by Dennis Ritchie between 1969 and 1973 at Bell Laboratories.


Q.5: What is programming language?
Ans.
Programmers write computer programs in these special languages (C, C++ Java etc.) called programming languages. Java, C, C++, C#, Python are some of the most commonly used programming languages.


Q.6: What is Programming Environment?
Ans.
A collection of all the necessary tools for programming makes up a Programming environment. It is essential to setup a programming environment before we start writing programs. It works as a basic platform for us to write and execute programs.


Q.7: What is Integrated Development Environment (IDE)?
Ans.
The software that provides a programming environment to facilitate programmers in writing and executing computer programs is known as an Integrated Development Environment (IDE).
An IDE has a graphical user interface (GUI), meaning that a user can interact with it using windows and buttons to provide input and get output.


Q.8: Writer down the IDEs for C programming language.
Ans.
1) Visual Studio 2) Xcode 3) Code::Blocks 4) Dev C++


Q.9: What is the purpose of text editor? (OR) What is text editor?
Ans.
A text editors is a software that allows programmers to write and edit computer Programs. All IDEs had its own specific text editors.


Q.10: What is the purpose of compiler in C language? (OR) What is compiler?
Ans.
A compiler is software that is responsible for conversion of a computer program written in some high level programming language to machine language code.


Q.11: What is syntax?
Ans.
The set of rules used to write an accurate program is known as syntax of the language. Syntax can be thought of as grammar of a programming language.


Q.12: What is syntax error?
Ans.
While programming, if proper syntax or rules of the programming language are not fdlowed, the program does not compiled. In this case, the compiler generates an error. This kind of errors
is called syntax errors.


Q.13: What do you know about reserved words? (OR)Write down the name of some reserved words.
Ans.
Every programming language has a list of words that are predefined. Each word has its specific meaning already known to the compiler. These words are known as reserved words or keywords. Some names of reserved words are as follows: auto, int, else, switch and return.


Q.14: Write down the name of main parts of structure of a C program.
Ans.
A program can be divided into three main parts:

  • Link section or header section:
  • Main section
  • Body of main () function:

Q.15: What is link section or header section?
Ans.
While writing programs in C language, we make extensive use of functions that are already defined in the language. But before using the existing functions, we need to include the files where these functions have been defined. These files are called header files. We include these header files in our program by writing the include statements at the top of program.


Q.16: Write down the general structure of an include statement.
Ans.
General Structure of an include statement is as follows; #include


Q.17: Explain the general structure of an include statement.
Ans.
General Structure of an include statement is as follows; #include
Here header file name can be the name of any header file in the above example. We have included file stdio.h that contains information related to input and output functions. Many other header files are also available for example file math.h contains all predefined mathematics
functions.


Q.18: What is main section of C language?
Ans.
It consists of a main function. Every C program must contain a main() function and it is the starting point of execution.


Q.19: What is the body of main () section?
Ans.
The body of main() is enclosed in the curly braces {}. All the statements inside these curly braces make the body of main function.


Q.20: Write down the three key points to write C Language program correctly.
Ans.
(i) The sequence of statements in a C language program should be according to the sequence in which we want our program to be executed.
(ii) C language is case sensitive. It means that if a keyword is defined with all small case letters, we cannot capitalize any letter i.e. int is different from Int.
(iii) Each statement ends with a semi-colon; symbol.


Q.21: What are comments? Also write example.
Ans.
Comments are the statements in a program that are ignored by the compiler and do not get executed. Usually comments are written in natural language.
Example: In English language, in order to provide description of our code.


Q.22: Write down the purpose of writing comments?
Ans.
Comments can be considered as documentation of the program. Their purpose is.
1.It facilitates other programmers to understand our code.
2.It helps us to understand our own code even after years of writing it. We do not want these statements to be executed, because it may cause syntax error as the statements are written in natural language.


Q.23: How many types of comments are?
Ans.
In C programming language, there are two types of comments:
1. Single-line Comments
2. Multi-line Comments


Q.24: What is the difference between single -line comments and multi-line comments?
Ans.
Single-line comments start with //. Anything after // on the same line, is considered a comment. For example, //This is a comment.
Multi line comments start with /* and end at /. Anything between / and / is considered a comment, even on multiple lines. For example, /this is
a multi-line comment */

Q.25: What do you know about constants?
Ans.
Constants are the values that cannot be changed during the execution of a program
e.g. 5, 75.7, 1500 etc. In C language, there are three types of constants:
1. Integer Constants 2. Real Constants 3. Character Constants

Q.26. How you can explain integer constants?
Ans.
These are the values without a decimal point e.g. 7, 1256, 30100, 53555, -54, -2349 etc. It can be positive or negative. If the value is not preceded by a sign, it is considered as positive.


Q.27: Differentiate between Real Constants and Character Constants?
Ans.
The differences are as follows:
Real Constant
These are the values including a decimal point e.g. 3.14, 15.3333, 75.0, -1575.76, -7941.2345 etc. They can also be positive or negative
Character Constant
Any single small case letter, upper case letter, digit, punctuation mark, special symbol enclosed within” is considered a character constant e.g. ‘5’, ‘7’, ‘a’. ‘X’, ‘.’ etc.

Q.28: What is Variables?
Ans.
A variable is actually a name given to a merhory location, as the data is physically stored inside the computer’s memory. The value of a variable can be changed in a program. It means that, in a program, if a variable contains value 5, then later we can give it another value that replaces the value 5.
Example: height, Average, Weight, _var1.


Q.29: How many Data Type of a Variable are?
Ans.
The data types of variable are as under:
Integer – int (signed/unsigned)
Floating Point – float
Character – char


Q.30: Define Integer?
Ans.
Integer data type is used to store integer values (whole numbers). Integer takes up 4 bytes of memory. To declare a variable of type integer, we use the keyword int.


Q.31: What is difference between Signed Int and Unsigned Int?
Ans. Signed int

A signed Int can store both positive and negative values ranging from -2,147,483,648 to 2,147,483,647. By default, type Int is Considered as a signed integer.
Unsigned int
An unsigned Int can store only positive values and its value ranges from 0 to +4,294,967,295. Keyword unsigned Int is used to declare an unsigned integer.


Q.32: What is floating point data?
Ans.
Float data type is used to store a real number (number with floating point) up to six digits of precision. To declare a variable of type float, we use the keyword float. A float uses 4 bytes of memory. Its value ranges from 3.4×10-3 to 3.4x 1038.


Q.33: What is the purpose of character-char data type?
Ans.
To declare character type variables in C, we use the keyword char. It takes up just 1 byte of memory for storage. A variable of char type can store one character only.

Q.34: Write down the any two rules for naming variables.
Ans.
1. A variable name can only contain alphabets (uppercase or lowercase) digits and underscore sign.
2. Variable name must begin with a letter or an underscore, it cannot begin with a digit.


Q.35: What is difference between Variables and Constants?
Ans.
The difference between variables and constants are as follows:
Variable
A variable is actually a name given to a memory location, as the data is physically stored inside the computer’s memory. The value of a variable can be changed in a program. It means that, in a program, if a variable contains value 5, then later we can give it another value that replaces the value 5. Some examples of valid variable names are height, Average, Weight, _var1.
Constant

Constants are the values that cannot be changed in a program e.g. 5, 75.7, 1500 etc. In C language, there are three types of constants:
Integer Constants
Real Constants
Character Constants


Q.36: What is variable declaration?
Ans.
Declaring variable includes specifying its data type and giving it a valid name. Following syntax can be followed to declare a variable.
Data_type variable_name;
Some examples of valid variable declarations are as follows: Unsigned Int age; float height;


Q.37: What is variable initialization?
Ans.
Assigning value to a variable for the first time is called variable initialization. C language allows us to initialize a variable both at the time of declaration, and after declaring it.


Q.38: Write down structure for initializing variable.
Ans
. For initializing a variable at the time of declaration, we use the following general structure.
data_type variable_name = value; le data_type to

Multiple Choice Question

MCQS

1. The series of instructions 1 that given to the computer are known as a:
A. Computer Program
B. Software
C. Hardware
D. Both A And B✅


2. The process of feeding or storing these instructions in the computer is known as…
A. Computer language
B. Software
C. Computer programming✅
D. Programming environment


3. The person who knows how 3 to write a computer program correctly is known as a:
A. Developer
B. Programmer✅
C. Hacker
D. heft


4. Computers cannot understand
A. English
B. Urdu
C. Arabic
D. all of these✅


5. Programmers write computer 5 programs in these special languages called:
A. Computer program
B. Programming languages✅
C. Reserved words
D. None of these


6. Programmer needs proper for programming.
A. Hardware
B. Software
C. Tools✅
D. Computer
7. IDE stand for:


A. Integrated Development Environment✅
B. International Development Environment
C. Integrated Development Experiment
D. Integrated Donation Environment


8. A software that provides a programming environment to facilitate programmers in writing and executing computer programs is known as an:
A. International Development Environment
B. Reserved Words
C. Programming environment
D. Integrated Development Environment✅


9. IDEs for C programming language are:
A. Visual Studio
B. Xcode
C. Code::Blocks
D. All of these✅


10. A is a software that 10 allows programmers to write and edit computer Programs.
A. text editors✅
B. Compiler
C. Computer
D. Software


11. All IDEs have their own specific:
A. Compiler
B. IDE
C. Texteditors✅
D. Identity


12. Computers only understand 12 and work in machine language consisting of:
A. Alphabet
B. Os and 1s✅
C. only 1s
D. Only Os


13. A…….is a software that is responsible for conversion of a computer program written in some high level programming language to machine language code.
A. Compiler✅
B. Interpreter
C. Machine
D. Printer


14. Each programming language has some primitive building blocks and provides same 14 rules in order to write an accurate program. This set of rules is known as ..of the language.
A. Software
B. Instruction
C. Error
D. Syntax✅


15. While programming, if proper syntax or rules of the programming language are not followed, the program does not get compiled. In this case, the compiler generates an error. This kind of errors is called.
A. Syntax errors✅
B. Logical error
C. Programming error
D. Machine

16. Which one from the following reserved word? is not a wing
A. Auto
B. int
C. case
D. print✅


17. The main parts of structure of structur of C program are:
A. 2
B. 3✅
C. 4
D. 5

18. General structure of an 18 include statement is as:
A. #include✅
B. #include
C. #include(hea der_file_name>
D. #include<h eader_file_ name

19. Every C program must contain a function and it is the starting point of execution.
A. main()✅
B. header files
C. Body
D. ll of these


20. The body of main() is enclosed in:
A. <>
B. []C. {}✅
D. ()


21. are the statements in a program that are ignored by the compiler and do not get executed.
A. Syntax
B. Comments✅
C. Reserve word
D. Header

22. The type of comments:
A. Single-line Comments
B. Multi-line Comments
C. Both a and b✅
D. None of these


23. Single-line comments start with:
A. .
B. /
C. //✅
D. ;


24. Multi line comments start with:
A. >
B. /*✅
C. ??
D. //


25. Multi line comments end at:
A. {
B. //
C. /*
D. /

26. Which one from the following is not special symbol?

A. //
B. 6✅
C. .
D. ?


27. The alphabets, digits and special symbols when combined in an allowable manner form:
A. Constants
B. Variables
C. Keywords
D. All of these✅


28. are the values that cannot be changed by a program.
A. Character Constants
B. Integer Constants
C. Constants✅
D. Real constants


29. The types of Constants are:
A. Integer Constants
B. Real constants
C. Character Constants
D. All of these✅


30. The values without a decimal point:
A. Integer Constants✅
B. Real constants
C. Character Constants
D. Variables


31. Which one of the following is a real constant?
A. -7941.2345✅
B. 79412345
C. -792345a
D. -7941.23457


32. A is actually a name given to a memory location, as the data is physically stored inside the computer’s memory.
A. Constants
B. Variable✅
C. Reserved words
D. Comments


33. The value of a can be changed in a program.
A. Variable✅
B. Constants
C. Comments
D. None of these


34. Data type of a variables are:
A. 3✅
B. 4
C. 5
D. 1


35. Integer data type is used to store:
A. Float value
B. Signed int value
C. Integer values✅
D. Real value


36. Integer takes up bytes of memory.
A. 2
B. 4✅
C. 6
D. 8


37. A signed int can store:
A. Positive value
B. Negative value
C. Both a and b✅
D. None of these


38. By default, type int is Considered as a:
A. Char integer
B. Unsigned integer
C. Signed integer✅
D. Float


39. The ranges of Unsigned int is form:
A. 0 to 4, 294, 967, 295✅
B. 0 to plus/minus 4 ,294,967,295
C. 0 to – 4,294,967,295
D. 0 to 2.1122222


40. type is used to store a real number (number with floating point) up to six digits of precision.
A. Real data
B. Float data✅
C. Int data
D. Char data


41. The value ranges of floating data point is form:
A. 4.4 * 10 ^ – 30 * tc 3.4 * 10 ^ 38
B. 3.4 * 10 ^ – 37 * to 3.4 * 10 ^ 37
C. 4.4 * 10 ^ – 38 * to 4.4 * 10 ^ 38
D. 3.4 * 10 ^ – 38 * to 3.4 * 10 ^ 38✅


42. Some examples of valid variable declarations are:
A. unsigned int age;
B. float height;
C. int salary;
D. All of these✅

Related Articles

Back to top button
Enable Notifications OK No thanks