Skip to content
noteswale

Units

Number systems, logic gates, languages notes

Ready

Number systems, logic gates, languages is a topic in Elementary Computer Applications (Units) for B.A. Hindi (CBCS 2025–28), Faculty of Arts at Maharaja Ganga Singh University, Bikaner.

This unit is how the machine counts, decides and is told what to do. Number systems and their conversions: binary, octal, decimal, hexadecimal. Logic…

Unit 2 · Number systems, logic gates, languages

This unit is how the machine counts, decides and is told what to do. Number systems and their conversions: binary, octal, decimal, hexadecimal. Logic gates. Languages: machine, assembly and high-level, including 3GL and 4GL. A non-scientific calculator is allowed in the exam; the conversions below can be checked with one. Hardware of Unit 1 is assumed: the ALU works in binary; a program is a list of instructions.

Facts follow P. K. Sinha, Computer Fundamentals; Satish Jain, Shashank Jain and Dr. Madulika Jain, IT Tools and Application; Vikas Gupta, Rapidex Computer Course; and Hindi wording in Niranjan Bansal and Jayshri Saragoi, Computer made Easy for Beginners.

यह इकाई बताती है मशीन कैसे गिनती है, फैसला करती है और उसे काम कैसे बताया जाता है। संख्या-पद्धति और रूपांतरण: binary, octal, decimal, hexadecimal। Logic gates. भाषाएँ: मशीन, assembly और उच्च-स्तरीय, 3GL और 4GL समेत। परीक्षा में गैर-वैज्ञानिक कैलकुलेटर चलता है; नीचे के रूपांतरण उसी से जाँचे जा सकते हैं। इकाई 1 का हार्डवेयर माना गया है: ALU binary में काम करता है; प्रोग्राम निर्देशों की सूची है।

तथ्य P. K. Sinha, Computer Fundamentals; Satish Jain, Shashank Jain और Dr. Madulika Jain, IT Tools and Application; Vikas Gupta, Rapidex Computer Course; तथा Niranjan Bansal और Jayshri Saragoi, Computer made Easy for Beginners से हैं।

1 Number systems: decimal, binary, octal, hexadecimal

A number system is a way of writing numbers with a fixed set of digits and a base (also called radix). The base is how many different digits the system uses. Place value is digit × (base raised to the place). The four systems named here are decimal (base 10), binary (base 2), octal (base 8) and hexadecimal (base 16). A subscript or a prefix marks the base: 3610, 1001002, 448, 2416. Pass mark 36 in decimal is still 36 when the ALU sees 100100 in binary.

Decimal is the human system. Digits 0–9. Places: units, tens, hundreds (100, 101, 102). Anil’s roll 2145 means 2×1000 + 1×100 + 4×10 + 5×1. We use decimal on the OMR sheet and on the mark-list; the CPU does not add in decimal inside the ALU.

Binary is the machine’s system. Digits only 0 and 1, called bits. Places are powers of 2: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048… A computer is a nest of switches; a switch is on or off, so two symbols are enough. Unit 1’s bit and byte start here: eight bits make one byte. Binary is the same amount written with two digits.

Octal uses digits 0–7. Places are powers of 8: 1, 8, 64, 512… It is a short way to write binary, because 8 = 23, so three binary bits make one octal digit. Older books and some machine dumps use octal. Digit 8 or 9 cannot appear in a pure octal number.

Hexadecimal (hex) uses sixteen symbols: 0–9 and A–F (A=10, B=11, C=12, D=13, E=14, F=15). Places are powers of 16: 1, 16, 256, 4096… 16 = 24, so four binary bits make one hex digit. Memory addresses and colour codes on a lab PC are often hex because a byte (00 to FF) is two hex digits, not eight binary digits. 3610 = 2416: 2×16 + 4.

संख्या-पद्धति अंकों के निश्चित समूह और एक आधार (base / radix) से संख्या लिखने का तरीका है। आधार बताता है कितने अलग अंक चलते हैं। स्थान-मान = अंक × (आधार की घात)। चार नाम: decimal (10), binary (2), octal (8), hexadecimal (16)। आधार निशान: 3610, 1001002, 448, 2416। उत्तीर्ण 36 decimal में ALU को 100100 binary दिखता है।

Decimal मनुष्य की पद्धति। अंक 0–9। स्थान: इकाई, दस, सौ। रोल 2145 = 2×1000 + 1×100 + 4×10 + 5×1। OMR और अंक-सूची decimal में; ALU अंदर decimal में नहीं जोड़ता।

Binary मशीन की पद्धति। अंक केवल 0 और 1 (bit)। स्थान 2 की घातें: 1, 2, 4, 8, 16, 32, 64, 128… कंप्यूटर स्विचों का घोंसला है; स्विच चालू या बंद, इसलिए दो चिह्न काफी। इकाई 1 का bit और byte यहीं से: आठ bit = एक byte।

Octal अंक 0–7। स्थान 8 की घातें। Binary लिखने का छोटा रूप, क्योंकि 8 = 23, तीन binary bit = एक octal अंक। अंक 8 या 9 शुद्ध octal में नहीं आते।

Hexadecimal सोलह चिह्न: 0–9 और A–F (A=10 … F=15)। स्थान 16 की घातें। 16 = 24, चार binary bit = एक hex अंक। लैब PC पर स्मृति-पते और रंग अक्सर hex में: एक byte (00 से FF) दो hex अंक, आठ binary नहीं। 3610 = 2416।

SystemBaseDigitsWhy it is used
Decimal100–9Humans; marks, roll numbers
Binary20, 1ALU, memory bits
Octal80–7Short binary (groups of 3 bits)
Hexadecimal160–9, A–FShort binary (groups of 4 bits); addresses
पद्धतिआधारअंककाम
Decimal100–9मनुष्य; अंक, रोल
Binary20, 1ALU, स्मृति के bit
Octal80–7छोटी binary (3 bit के समूह)
Hexadecimal160–9, A–Fछोटी binary (4 bit); पते

2 Conversions among the four systems

Other base → decimal. Expand by place value and add. Binary 1001002 = 1×32 + 0×16 + 0×8 + 1×4 + 0×2 + 0×1 = 3610. Octal 448 = 4×8 + 4×1 = 3610. Hex 2416 = 2×16 + 4×1 = 3610. Hex 2F16 = 2×16 + 15 = 4710.

Decimal → binary, octal or hex. Divide the decimal number by the new base. Write the remainder. Divide the quotient again. Stop when the quotient is 0. Read remainders from bottom to top. Pass mark 36 to binary: 36÷2 → 18 r0; 18÷2 → 9 r0; 9÷2 → 4 r1; 4÷2 → 2 r0; 2÷2 → 1 r0; 1÷2 → 0 r1. Remainders upward: 1001002. 36 to octal: 36÷8 → 4 r4; 4÷8 → 0 r4 → 448. 36 to hex: 36÷16 → 2 r4 → 2416.

Paper maximum 100: 100÷2 chain gives 11001002; 100÷8 gives 1448; 100÷16 gives 6416. Roll 2145: 2145÷2 remainders upward give 1000011000012 (211=2048, plus 64, 32 and 1). Same 2145 is 41418 and 86116.

Binary ↔ octal. Group binary bits in threes from the right. Pad the left with zeros if needed. Each triad is one octal digit (000=0 … 111=7). 11001002 → 001 100 100 → 1 4 4 → 1448. Reverse: write each octal digit as three bits.

Binary ↔ hex. Group in fours from the right. Each tetrad is one hex digit (0000=0 … 1111=F). 11001002 → 0110 0100 → 6 4 → 6416. Reverse: write each hex digit as four bits. A=1010, B=1011, C=1100, D=1101, E=1110, F=1111.

Binary to hex need not pass through decimal: group by four. Octal to hex: octal → binary → hex (or octal → decimal → hex). Example: 448 → 100 1002, pad to 0010 0100 → 2416. Binary never shows the digit 2; octal never shows 8; hex may show A–F.

दूसरा आधार → decimal. स्थान-मान खोलो, जोड़ो। 1001002 = 32+4 = 3610। 448 = 32+4 = 36। 2416 = 32+4 = 36। 2F16 = 32+15 = 4710।

Decimal → binary, octal, hex. नई आधार से भाग दो। शेष लिखो। भागफल पर फिर भाग। भागफल 0 हो तो रुको। शेष नीचे से ऊपर पढ़ो। 36 → binary: शेष 0,0,1,0,0,1 ऊपर को 1001002। 36 → octal 448। 36 → hex 2416।

100 अंक: 11001002, 1448, 6416। रोल 2145: 1000011000012, 41418, 86116।

Binary ↔ octal. दाएँ से तीन-तीन bit। बाएँ शून्य भर सकते हो। 11001002 → 001 100 100 → 1448। उलटा: प्रत्येक octal अंक तीन bit।

Binary ↔ hex. दाएँ से चार-चार bit। 11001002 → 0110 0100 → 6416। A=1010 … F=1111।

Binary से hex: चार के समूह, decimal की सैर बिना। Octal से hex: octal → binary → hex (या decimal होकर)। उदाहरण: 448 → 100 1002, 0010 0100 → 2416। Binary में अंक 2 नहीं; octal में 8 नहीं; hex में A–F चलते हैं।

DecimalBinaryOctalHex
10101012A
15111117F
36 (pass)1001004424
100 (paper)110010014464
2145 (roll)1000011000014141861
DecimalBinaryOctalHex
10101012A
15111117F
36 (उत्तीर्ण)1001004424
100 (पत्र)110010014464
2145 (रोल)1000011000014141861

3 Logic gates

A logic gate is an electronic circuit that takes one or more binary inputs (0 or 1) and gives a single binary output by a fixed rule. 1 is also called HIGH or TRUE; 0 is LOW or FALSE. The ALU’s decisions are built from gates. Boolean 0/1 is the algebra of these gates; this lesson is the gates themselves, with a truth table for each.

AND. Output is 1 only if every input is 1. Two inputs A, B: 1 only for A=1 and B=1. Classroom: the lab printer prints a mark-sheet only if marks ≥ 36 and fees are paid. One false input, output 0.

OR. Output is 1 if at least one input is 1. 0 only when all inputs are 0. Classroom: the door alarm sounds if the window is open or the door is open.

NOT (inverter). One input. Output is the opposite: 1 becomes 0, 0 becomes 1. A bar over the name (Ā) marks NOT A.

NAND is AND followed by NOT: output is 0 only when every input is 1; otherwise 1. NOR is OR followed by NOT: output is 1 only when every input is 0. NAND and NOR are called universal gates: any other gate can be built from NAND alone, or from NOR alone.

XOR (exclusive OR). Output is 1 if the inputs are different (01 or 10), 0 if they are the same (00 or 11). XNOR (exclusive NOR) is the opposite: 1 if the inputs are the same. XOR is the classroom “odd one”: one switch on, lamp on; both on or both off, lamp off.

Logic gate वह इलेक्ट्रॉनिक परिपथ है जो एक या अधिक binary निवेश (0 या 1) लेकर एक नियम से एक binary निर्गम देता है। 1 = HIGH / TRUE; 0 = LOW / FALSE। ALU के फैसले गेटों से बनते हैं। Boolean 0/1 इन गेटों का बीजगणित है; यह पाठ गेट स्वयं हैं, प्रत्येक की truth table के साथ।

AND. निर्गम 1 तभी जब हर निवेश 1 हो। कक्षा: प्रिंटर अंक-पत्र तभी जब अंक ≥ 36 और शुल्क भरा हो। एक भी 0 तो निर्गम 0।

OR. निर्गम 1 यदि कम से कम एक निवेश 1 हो। सभी 0 हों तभी निर्गम 0। दरवाज़ा-अलार्म: खिड़की खुली या दरवाज़ा खुला।

NOT (इनवर्टर)। एक निवेश। उलटा: 1→0, 0→1। Ā = NOT A।

NAND = AND फिर NOT: सभी निवेश 1 हों तभी निर्गम 0। NOR = OR फिर NOT: सभी 0 हों तभी निर्गम 1। NAND और NOR universal gates हैं: कोई भी दूसरा गेट केवल NAND से, या केवल NOR से, बनाया जा सकता है।

XOR निर्गम 1 जब निवेश अलग (01 या 10)। XNOR उलटा: समान हों तो 1। XOR: एक स्विच चालू तो दीया; दोनों चालू या दोनों बंद तो दीया बुझ।

ABANDORNANDNORXORXNOR
00001101
01011010
10011010
11110001
ABANDORNANDNORXORXNOR
00001101
01011010
10011010
11110001

NOT: निवेश 0 तो निर्गम 1; निवेश 1 तो निर्गम 0। NAND = AND का उलटा; NOR = OR का उलटा; XNOR = XOR का उलटा।

4 Machine, assembly and high-level languages · 3GL, 4GL

A programming language is a coded way to write the instructions the CPU will follow. Unit 1’s generations already named the climb: first generation machine language, second assembly, then high-level. This lesson names the languages and the translators.

Machine language is binary: only 0 and 1, in the exact pattern that one CPU model understands. It needs no translator. It is fast to run and painful to write. A program written for one microprocessor will not run on another without change. First-generation machines were programmed this way.

Assembly language replaces raw bits with short mnemonics: ADD, SUB, MOV, JMP. One assembly line still maps to about one machine instruction. An assembler translates assembly into machine language. The programmer must still know registers and memory. Second-generation work sat here.

High-level language (HLL) looks closer to English and maths: a line can stand for many machine instructions. The same source can be compiled for more than one CPU. FORTRAN, COBOL, BASIC, C, Pascal, Java sit here. A compiler translates the whole program into machine code, then you run the result. An interpreter translates and runs line by line (classic BASIC). A compiler finds many errors before the program runs; an interpreter stops at the first error it meets while running.

Books also call machine language 1GL and assembly 2GL. 3GL (third-generation language) is the classic high-level procedural language: you write how to do the job, step by step — loops, if-then, variables. COBOL, FORTRAN, C, Pascal, Java are 3GL. 4GL (fourth-generation language) sits closer to the human’s what: you name the result more than the steps. Report generators, query languages such as SQL (“list students with marks below 36”), form painters and some database tools are named 4GL in Sinha and Rapidex. 4GL is not “the language of a fourth-generation PC”; a PC can run 3GL. The generation-number of the language is not the generation-number of the hardware.

प्रोग्रामिंग भाषा वह कूट है जिससे CPU के निर्देश लिखे जाते हैं। इकाई 1 की पीढ़ियाँ चढ़ाई नाम कर चुकी हैं: पहली मशीन भाषा, दूसरी assembly, फिर उच्च-स्तरीय। यह पाठ भाषाएँ और अनुवादक नाम करता है।

मशीन भाषा binary है: केवल 0 और 1, उसी पैटर्न में जो एक CPU मॉडल समझे। अनुवादक नहीं चाहिए। चलना तेज़, लिखना कठिन। एक माइक्रोप्रोसेसर का प्रोग्राम दूसरे पर बिना बदलाव नहीं चलता। पहली पीढ़ी यहीं।

Assembly कच्चे bit की जगह छोटे mnemonic: ADD, SUB, MOV, JMP। एक पंक्ति लगभग एक मशीन-निर्देश। Assembler assembly को मशीन भाषा बनाता है। रजिस्टर और स्मृति अभी जाननी पड़ती है। दूसरी पीढ़ी यहीं।

उच्च-स्तरीय भाषा (HLL) अंग्रेज़ी और गणित के निकट: एक पंक्ति कई मशीन-निर्देश बन सकती है। वही स्रोत एक से अधिक CPU के लिए कंपाइल हो सकता है। FORTRAN, COBOL, BASIC, C, Pascal, Java। Compiler पूरा प्रोग्राम मशीन कोड में बदलता है, फिर चलाते हो। Interpreter पंक्ति-दर-पंक्ति अनुवाद कर चलाता है (क्लासिक BASIC)। Compiler बहुत सी त्रुटियाँ चलने से पहले पकड़ता है; interpreter चलते समय पहली त्रुटि पर रुकता है।

पुस्तकें मशीन भाषा को 1GL और assembly को 2GL भी कहती हैं। 3GL क्लासिक उच्च-स्तरीय प्रक्रिया भाषा: कैसे करना है, चरण-दर-चरण — लूप, if-then, चर। COBOL, FORTRAN, C, Pascal, Java। 4GL मनुष्य के क्या के निकट: परिणाम नाम करते हो, चरण कम। Report generator, SQL जैसी query भाषा (“36 से कम अंक वाले विद्यार्थी दिखाओ”), फॉर्म-पेंटर, कुछ डेटाबेस औज़ार — Sinha और Rapidex इन्हें 4GL कहते हैं। 4GL का अर्थ “चौथी पीढ़ी के PC की भाषा” नहीं; PC 3GL भी चलाता है। भाषा की पीढ़ी हार्डवेयर की पीढ़ी नहीं।

LanguageLooks likeTranslator
Machine (1GL)0 and 1 onlyNone
Assembly (2GL)ADD, MOV…Assembler
3GL (high-level)English-like steps: C, COBOL, FORTRANCompiler or interpreter
4GLName the result: SQL, report tools4GL environment / compiler
भाषादिखती कैसेअनुवादक
मशीन (1GL)केवल 0 और 1कोई नहीं
Assembly (2GL)ADD, MOV…Assembler
3GLअंग्रेज़ी जैसे चरण: C, COBOL, FORTRANCompiler या interpreter
4GLपरिणाम नाम: SQL, रिपोर्ट औज़ार4GL वातावरण / compiler

© noteswale.com — for personal exam prep only

More in Units

These Elementary Computer Applications notes for B.A. Hindi belong to the B.A. Hindi syllabus on noteswale.