Computer Programming Bihar STET Computer Science का एक महत्वपूर्ण topic है। परीक्षा में Programming Fundamentals, Algorithms, Flowcharts, Variables, Data Types, Operators, Control Statements, Functions, Arrays, Pointers, OOP और Programming Languages से questions पूछे जा सकते हैं।
1. What is Computer Programming?
Computer Programming वह process है जिसमें किसी समस्या को हल करने के लिए computer को instructions दिए जाते हैं।
इन instructions को Program कहा जाता है।
Example
यदि दो numbers को जोड़ना है:
Input → Two Numbers
Process → Addition
Output → SumImportant Terms
| Term | Meaning |
|---|---|
| Program | Computer को दिए गए instructions का set |
| Programmer | Program लिखने वाला व्यक्ति |
| Programming Language | Program लिखने की language |
| Source Code | Programmer द्वारा लिखा गया code |
| Object Code | Machine-readable code |
| Compiler | पूरे program को एक साथ translate करता है |
| Interpreter | Program को line-by-line execute करता है |
2. Programming Languages
Programming languages को सामान्यतः तीन categories में समझा जा सकता है:
1. Machine Language
- यह 0 और 1 के रूप में होती है।
- Computer directly machine language को समझता है।
- इसे First Generation Language (1GL) कहा जाता है।
2. Assembly Language
- इसमें symbolic instructions का उपयोग होता है।
- जैसे:
ADD,SUB,MOV - इसे Second Generation Language (2GL) कहा जाता है।
- Assembly language को translate करने के लिए Assembler का उपयोग होता है।
3. High-Level Language
Human-readable syntax का उपयोग करती है।
Examples:
- C
- C++
- Java
- Python
- FORTRAN
- COBOL
High-level language को machine language में बदलने के लिए compiler या interpreter का उपयोग किया जाता है।
3. Algorithm
किसी problem को solve करने के लिए लिखे गए step-by-step instructions को Algorithm कहते हैं।
Characteristics of Algorithm
एक अच्छे algorithm में सामान्यतः:
- Input
- Output
- Definiteness
- Finiteness
- Effectiveness
होते हैं।
Example: Two Numbers Addition
Step 1: Start
Step 2: Read A and B
Step 3: SUM = A + B
Step 4: Display SUM
Step 5: Stop4. Flowchart
किसी algorithm को graphical form में represent करने को Flowchart कहते हैं।
Important Flowchart Symbols
| Symbol | Purpose |
|---|---|
| Oval | Start/Stop |
| Rectangle | Process |
| Parallelogram | Input/Output |
| Diamond | Decision |
| Arrow | Flow direction |
Exam Point
Diamond symbol का उपयोग Decision/Condition के लिए किया जाता है।
5. Variables
Variable memory में data store करने के लिए उपयोग किया जाने वाला नाम है।
Example:
int age = 25;यहाँ:
age= Variable25= Valueint= Data Type
Rules for Variable Names
- Variable digit से start नहीं होना चाहिए।
- Space का उपयोग नहीं किया जाता।
- Reserved keyword को variable name के रूप में उपयोग नहीं कर सकते।
- Letters, digits और underscore का उपयोग किया जा सकता है।
6. Constants
जिस value को program execution के दौरान बदला नहीं जाता, उसे Constant कहते हैं।
Examples:
10
3.14
'A'
"Hello"Types of Constants
- Integer Constant
- Floating Point Constant
- Character Constant
- String Constant
7. Data Types
Data type यह बताता है कि variable में किस प्रकार का data store होगा।
Common Data Types
| Data Type | Example |
|---|---|
| int | 10 |
| float | 10.5 |
| char | 'A' |
| double | 123.456 |
| boolean | true/false |
| string | "Computer" |
Exact data types और उनका size programming language पर depend कर सकता है।
8. Operators
Operators ऐसे symbols हैं जिनका उपयोग operations perform करने के लिए किया जाता है।
Arithmetic Operators
+ Addition
- Subtraction
* Multiplication
/ Division
% ModulusRelational Operators
>
<
>=
<=
==
!=Logical Operators
&& AND
|| OR
! NOTAssignment Operator
=Example:
x = 10;Increment/Decrement
++ Increment
-- Decrement9. Control Statements
Program के execution flow को control करने वाले statements को control statements कहते हैं।
मुख्यतः तीन प्रकार:
1. Decision/Selection Statements
- if
- if-else
- else-if
- switch
Example:
if (marks >= 40)
{
printf("Pass");
}
else
{
printf("Fail");
}2. Looping Statements
- for
- while
- do-while
इनका उपयोग किसी statement को repeatedly execute करने के लिए किया जाता है।
3. Jump Statements
- break
- continue
- goto
- return
10. for Loop
जब iterations की संख्या पहले से पता हो, तब for loop उपयोगी होता है।
for(i = 1; i <= 5; i++)
{
printf("%d", i);
}यह 1 से 5 तक numbers print करेगा।
11. while Loop
जब condition के आधार पर loop चलाना हो, तब while loop का उपयोग किया जाता है।
while(condition)
{
// statements
}यह entry-controlled loop है।
12. do-while Loop
do
{
// statements
}
while(condition);यह exit-controlled loop है।
Important Point
do-while loop कम से कम एक बार execute होता है।
13. Functions
Function statements का एक reusable block होता है जो किसी specific task को perform करता है।
Example:
int add(int a, int b)
{
return a + b;
}Advantages
- Code reusability
- Program को modular बनाता है
- Debugging आसान होती है
- Program readability बढ़ती है
Function के मुख्य parts
- Function Declaration/Prototype
- Function Definition
- Function Call
14. Recursion
जब कोई function स्वयं को call करता है, तो इसे Recursion कहते हैं।
Example:
factorial(n)में factorial function स्वयं को call कर सकता है।
Important Point
Recursive function में base condition होना आवश्यक है, ताकि infinite recursion न हो।
15. Arrays
एक ही data type के multiple elements को contiguous memory locations में store करने के लिए Array का उपयोग किया जाता है।
Example:
int marks[5];इसमें 5 integer values store की जा सकती हैं।
Types
- One-dimensional Array
- Two-dimensional Array
- Multidimensional Array
Example:
int matrix[3][3];16. Strings
Characters का sequence String कहलाता है।
C language में string को character array के रूप में represent किया जाता है।
Example:
char name[] = "Ravi";C में string का अंत सामान्यतः null character \0 से होता है।
17. Pointers
Pointer एक ऐसा variable है जो किसी दूसरे variable का memory address store करता है।
Example:
int x = 10;
int *p = &x;यहाँ:
x= variable&x= address of xp= pointer
Important Operators
& → Address-of operator
* → Dereference operator
18. Structure
Structure अलग-अलग data types के variables को एक single unit में group करने के लिए उपयोग किया जाता है।
Example:
struct Student
{
int roll;
char name[20];
};19. Object-Oriented Programming (OOP)
OOP एक programming paradigm है जिसमें program को objects और classes के आधार पर design किया जाता है।
Important OOP Concepts
- Class
- Object
- Encapsulation
- Inheritance
- Polymorphism
- Abstraction
Class
Class objects का blueprint/template होती है।
Object
Class का instance Object कहलाता है।
20. Encapsulation
Data और methods को एक single unit में combine करने को Encapsulation कहते हैं।
21. Inheritance
एक class द्वारा दूसरी class की properties और methods को प्राप्त करने की प्रक्रिया Inheritance कहलाती है।
Common Types
- Single Inheritance
- Multiple Inheritance
- Multilevel Inheritance
- Hierarchical Inheritance
- Hybrid Inheritance
22. Polymorphism
एक interface या method का अलग-अलग forms में behave करना Polymorphism कहलाता है।
मुख्य प्रकार:
- Compile-time Polymorphism
- Run-time Polymorphism
23. Compiler
Compiler पूरे source program को एक साथ machine/object code में translate करता है।
Examples of compiled languages
C और C++ traditionally compiler-based languages के examples हैं।
24. Interpreter
Interpreter program को सामान्यतः statement/line-by-line translate और execute करता है।
Important Difference
| Compiler | Interpreter |
|---|---|
| पूरे program को translate करता है | Line/statement-wise translate करता है |
| Execution से पहले translation | Translation और execution साथ-साथ |
| Error reporting अलग तरीके से होती है | Error मिलने पर execution रुक सकता है |
| Generally execution के लिए compiled code उपयोग होता है | Generally अलग executable object code नहीं बनाता |
25. Syntax Error
Programming language के grammar/rules का उल्लंघन करने पर Syntax Error होता है।
Example:
printf("Hello"यदि closing bracket missing है, तो syntax error हो सकता है।
26. Logical Error
Program successfully execute हो सकता है, लेकिन गलत output देता है।
Example:
यदि average निकालने के बजाय programmer ने गलत formula लगा दिया।
27. Runtime Error
Program execution के दौरान होने वाली error को Runtime Error कहते हैं।
Examples:
- Division by zero
- Invalid memory access
- File not found
28. Debugging
Program में मौजूद errors को identify और remove करने की process को Debugging कहते हैं।
29. Programming Paradigms
Important programming paradigms:
- Procedural Programming
- Object-Oriented Programming
- Functional Programming
- Logic Programming
- Event-Driven Programming
Examples
C → Procedural
C++ / Java → Object-Oriented support
Python → Multi-paradigm
30. Important Programming Concepts for Bihar STET
Bihar STET Computer Science की तैयारी में इन topics पर विशेष ध्यान दें:
- Programming Fundamentals
- Algorithm
- Flowchart
- Programming Languages
- Compiler & Interpreter
- Variables & Constants
- Data Types
- Operators
- Expressions
- Conditional Statements
- Loops
- Functions
- Recursion
- Arrays
- Strings
- Pointers
- Structures
- Object-Oriented Programming
- Class & Object
- Inheritance
- Polymorphism
- Encapsulation
- Abstraction
- Errors & Debugging
Bihar STET Programming – Important MCQs
1. Computer को instructions के set को क्या कहा जाता है?
A. Data
B. Program
C. Hardware
D. Memory
Answer: B. Program
2. 0 और 1 पर आधारित language कौन-सी है?
A. Assembly Language
B. Machine Language
C. High-Level Language
D. SQL
Answer: B. Machine Language
3. Assembly language को machine language में बदलने वाला translator है:
A. Compiler
B. Interpreter
C. Assembler
D. Loader
Answer: C. Assembler
4. Algorithm क्या है?
A. Hardware device
B. Step-by-step procedure
C. Operating System
D. Database
Answer: B. Step-by-step procedure
5. Flowchart में decision को represent करने के लिए कौन-सा symbol प्रयोग होता है?
A. Rectangle
B. Oval
C. Diamond
D. Circle
Answer: C. Diamond
6. इनमें से कौन-सा arithmetic operator है?
A. &&
B. ==
C. %
D. ||
Answer: C. %
7. && operator किसके लिए प्रयोग होता है?
A. OR
B. AND
C. NOT
D. Assignment
Answer: B. AND
8. इनमें से कौन-सा looping statement है?
A. if
B. switch
C. for
D. break
Answer: C. for
9. कौन-सा loop कम से कम एक बार execute होता है?
A. for
B. while
C. do-while
D. if
Answer: C. do-while
10. Function का मुख्य लाभ क्या है?
A. Code reusability
B. Hardware control
C. Memory deletion
D. Virus protection
Answer: A. Code reusability
11. Array में सामान्यतः किस प्रकार के elements store किए जाते हैं?
A. Same data type
B. केवल characters
C. केवल integers
D. केवल strings
Answer: A. Same data type
12. Pointer क्या store करता है?
A. केवल value
B. Memory address
C. File name
D. Instruction
Answer: B. Memory address
13. & operator C में सामान्यतः क्या दर्शाता है?
A. Multiplication
B. Address-of
C. Division
D. Comparison
Answer: B. Address-of
14. जब function स्वयं को call करता है, उसे क्या कहते हैं?
A. Iteration
B. Recursion
C. Compilation
D. Encapsulation
Answer: B. Recursion
15. OOP में class क्या होती है?
A. Object का blueprint
B. Memory address
C. Loop
D. Operator
Answer: A. Object का blueprint
16. Class का instance क्या कहलाता है?
A. Method
B. Object
C. Function
D. Pointer
Answer: B. Object
17. Data और methods को एक unit में bind करना कहलाता है:
A. Inheritance
B. Encapsulation
C. Compilation
D. Recursion
Answer: B. Encapsulation
18. एक class द्वारा दूसरी class की properties प्राप्त करना कहलाता है:
A. Polymorphism
B. Inheritance
C. Abstraction
D. Debugging
Answer: B. Inheritance
19. Program के grammar/rules का violation किस error को जन्म देता है?
A. Logical Error
B. Syntax Error
C. Runtime Error
D. Hardware Error
Answer: B. Syntax Error
20. Program की errors को identify और remove करने की process क्या कहलाती है?
A. Debugging
B. Compiling
C. Loading
D. Linking
Answer: A. Debugging
Quick Revision – Bihar STET
Program → Set of instructions
Algorithm → Step-by-step solution
Flowchart → Graphical representation of algorithm
Compiler → Whole program translation
Interpreter → Statement/line-wise execution
Variable → Named storage location
Array → Collection of similar data elements
Pointer → Stores memory address
Function → Reusable block of code
Recursion → Function calling itself
Class → Blueprint of objects
Object → Instance of class
Encapsulation → Binding data and methods
Inheritance → Acquiring properties of another class
Polymorphism → One interface, multiple forms
Debugging → Removing program errors