संपादकीय लेखन notes hindi class 12th

संपादकीय लेखन

संपादकीय लेखन(sampadkiya lekhan ke gun) कला का सैद्धांतिक एवं व्यवहारिक दस्तावेज है क्योंकि प्रत्येक समाचार पत्र या पत्रिका के कुछ ऐसे मूलभूत सिद्धांत होते हैं, जिनका पालन नीति निर्देशक तत्वों के रूप में प्रत्येक संपादक या संपादकीय लेखक को करना होता है। प्रत्येक संपादक व संपादकीय लेखक अपनी बात कहने के लिए स्वतंत्र होता है।

समान्यतः, संपादकीय लेखन उसके लेखक के स्वभाव, रुचि एवं चरित्र की झलक प्रस्तुत करता है और उसके साथ ही उसकी मध्यानशीलता एवं ज्ञान की बहुआयामितता का परिचय देता है क्योंकि समाचार पत्र की नीति अनुपालन के साथ-साथ, विवेक कौशल पर भी आधारित रहता है।

संपादकीय लेखन में लेखक के लिए यह आवश्यक होता है कि चयनित विषय का अपने ढंग से प्रभावशाली और तर्क सहित प्रस्तुत करे। यहां यह कहना भी आवश्यक है की संपादकीय लेखक को इस बात का भी विशेष ध्यान रखना चाहिए कि जो पक्ष वह प्रस्तुत कर रहा है उसके विपक्ष में भी तर्क अवश्य प्रस्तुत किए जाने चाहिए।

अतः संपादकीय लेखक के लिए यह बात भली-भांति जान लेना उचित होता है कि, उसके लेखक का लक्ष्य क्या है और किसी लक्ष्य तक पहुंचने के लिए वह अपनी बात प्रभावशाली ढंग से कह सकता है या नहीं? यही कारण है कि प्रत्येक स्थिति या घटना का मूल्यांकन संपादकीय लेखक निम्न प्रकार(sampadkiya lekhan ke gun) से करते हैं:-

  1. घटना की जानकारी(भूमिका)।
  2. घटना की व्याख्या(विषय विश्लेषण)
  3. घटना की स्थिति का उल्लेख(विषय विश्लेषण)
  4. परिणामों से शिक्षा और सतर्कता(विषय विश्लेषण)
  5. स्थिति की वास्तविक समझ(निर्देश)
  6. मार्गदर्शन करना या मंच देना(निर्देश)
  7. निराकरण की प्रेरणा(निष्कर्ष)
  8. परिणामों के भावी स्थिति का संकेत(निष्कर्ष)

अच्छे संपादकीय के गुण

  • प्रारंभिक जानकारी
  • कई भाषाओं का ज्ञान
  • तकनीकी ज्ञान
  • पाठक के रुचि का ज्ञान
  • सत्यनिष्ठा

प्रक्रिया तत्व

  • शुरुआत
  • मध्य
  • अंत

संपादकीय लेखन के उद्देश्य

  • शिक्षित करना
  • जागरूक करना
  • परिवर्तन लाना
  • नकारात्मक और सकारात्मक पक्ष सामने रखना

संपादकीय लेखन का विषय चयन करने के आधार:-

  • पाठकों की रुचि
  • कोई विषय प्रभावशाली कितना है
  • पहुंच
  • व्यापकता

संपादकीय महत्व

  • प्रशासनिक कौशल
  • निर्देशनात्मक
  • संकलनात्मक कौशल
  • प्रस्तुतीकरण

विश्लेषण:- विस्तारपूर्वक जब किसी लेख को लिखा जाए।

टिप्पणी:- टिप्पणी किसी भी विषय पर लिखी जा सकती है। समाचार पत्रों में ये ज्यादातर सीधे हाथ के पहले कॉलम में लिखी जाती है। यह संपादकीय का छोटा संस्करण होता है। एक टिप्पणी लगभग 5 से 7 लाइन की हो सकती है।

टिप्पणी के सिद्धान्त:- 1) निष्पक्षता 2) पारदर्शिता 3)तटस्थ 4) लघु संस्करण

संपादक के नाम पत्र:- प्रक्रिया तत्व:- 1) शुरुआत:- घटना/बयान/हाल ही में/बीते दिनों में इत्यादि से शुरुआत करना। 2) बॉडी:- तथ्य,भाषा,डेटा आदि। 3)निष्कर्ष(अंत):- सुझाव

पत्र की विशेषताएं:-

  1. प्रासंगिक
  2. महत्वपूर्ण
  3. व्यापकता
  4. गहनता
  5. सत्यता
  6. तथ्यता
  7. स्पष्टता
  8. तर्कपूर्ण
  9. निष्कर्ष

समाचार संगठन की संरचना

  • प्रबंधन विभाग
  • संपादकीय विभाग
  • प्रशासनिक विभाग
  • वितरण विभाग
  • विज्ञापन विभाग
  • परिवहन विभाग
  • मुद्रण विभाग
  • इंजीनियर विभाग
Read More

जनसंचार माध्यम प्रिंट माध्यम notes hindi class 12th

जनसंचार माध्यम और लेखन ( अभिव्यक्ति और माध्यम )

अभिव्यक्ति और माध्यम किताब के मुख्य विषय जनसंचार माध्यम के बारे में आज हम पढ़ेंगे। सबसे पहले हम संचार विषय का बारीकी से अध्ययन करेंगे।

संचार व्यक्ति के जीवन को निरंतर सभ्य , शिक्षित बनाने का कार्य करता आया है।

पूर्व समय में भी व्यक्ति संचार के विभिन्न माध्यमों का प्रयोग किया करते थे। आज संचार के अनेक नए आधुनिक माध्यम आ गए हैं , किंतु मोटे तौर पर समझे तो संचार भावना तथा अभिव्यक्ति के आदान प्रदान करने की प्रक्रिया को कहते हैं।

संचार क्या है ? संचार ‘चर’ धातु से उत्पन्न हुआ है जिसका अर्थ है साथ साथ चलना अर्थात दो या दो से अधिक व्यक्तियों के बीच सूचनाओं विचारों और भावनाओं के आदान-प्रदान को संचार कहते हैं। यह जीवन भर चलने वाली प्रक्रिया है , सभी जीव संचार करते हैं , परंतु मनुष्य बौद्धिक रूप से विकसित होने के कारण सर्वोत्तम संचार करता है। संचार माध्यमों के विकास में भौगोलिक दूरियां कम हो गई है , एक उंगली के स्पर्श से दूर बैठे अपनों से संचार कर सकते हैं।

सूचनाओं विचारों और भावनाओं को मौखिक, लिखित अथवा दृश्य – श्रव्य माध्यमों के द्वारा सफलतापूर्वक एक स्थान से दूसरे स्थान पर पहुंचाना ही संचार है। संचार एक प्रक्रिया है जिसमें सूचना देने वाले और पाने वाले दोनों की ही सक्रिय भागीदारी आवश्यक है। एक के अभाव में भी यह संभव नहीं है , इस अर्थ में संचार अंतर क्रियात्मक (इंटरएक्टिव) प्रक्रिया है।

संचार के विभिन्न तत्व ( जनसंचार माध्यम और लेखन )

संचार के विभिन्न तत्व

  • स्रोत – संचार प्रक्रिया को प्रारंभ करता है , व्यक्ति अपने संदेश या सूचना को अन्य तक पहुंचाना चाहता है वह स्रोत है।
  • कूटीकृत या एन कोडिंग – संदेश की भाषा का ज्ञान संचारकर्ता व प्राप्तकर्ता दोनों को ही होनी चाहिए।
  • संदेश – सफल संचार के लिए संदेश का स्पष्ट और सीधा होना आवश्यक है।
  • माध्यम (चैनल) – संदेश को किस माध्यम (टेलीफोन , समाचारपत्र , रेडियो , इंटरनेट) से संदेश प्राप्तकर्ता तक पहुंचाया जाता है।
  • डिकोडिंग – प्राप्त संदेश में निहित अर्थ को समझना।
  • फीडबैक – फीडबैक के द्वारा पता चलता है कि संदेश सही रूप में प्राप्तकर्ता तक पहुंचा या नहीं।
  • शोर – संचार प्रक्रिया में आने वाली रुकावटें शोर कहलाती है। शोर मानसिक , तकनीकी और भौतिक भी हो सकती है।

संचार के प्रकार

  • सांकेतिक संचार – जब दो व्यक्ति आपस में इशारों के माध्यम से अपने भावनाओं को व्यक्त करते हैं अभिव्यक्ति करते हैं। उन्हें सांकेतिक संचार कहा जाता है।
  • मौखिक और अमौखिक संचार – जब मुंह खोलकर , बोलकर संचार करें वह मौखिक और बिना मुख खोले बात समझाएं या बताएं तब वह अमौखिक संचार होता है।
  • अंतः वैयक्तिक संचार – जब व्यक्ति अपने से बात करें अर्थात मन में प्रश्न करें और उत्तर भी दे वह अंतः व्यक्ति का संचार होता है।
  • अंतर व्यक्तिक संचार – जब दो व्यक्ति आमने-सामने बैठकर संचार करें वह अंतर व्यक्ति का संचार कहलाता है।
  • समूह संचार –  जब एक समूह आपस में विचार विमर्श या चर्चा करें तो उसे समूह संचार कहते हैं।
  • जनसंचार – जब हम समूह से यांत्रिकी या तकनीक के माध्यम से बात करते हैं तब उसे जनसंचार कहते हैं। यह माध्यम अखबार , रेडियो , टेलिविजन , सिनेमाघर या इंटरनेट कुछ भी हो सकता है।

संचार के कार्य

प्राप्ति , नियंत्रण , सूचना , अभिव्यक्ति , सामाजिक संपर्क , समस्या समाधान , प्रतिक्रिया और भूमिका को पूरा करने के लिए संचार का प्रयोग किया जाता है।

जनसंचार के कार्य

सूचना देना , शिक्षित करना , मनोरंजन करना , एजेंडा तय करना , निगरानी करना , विचारों की अभिव्यक्ति के लिए मंच उपलब्ध करना।

आधुनिक जनसंचार के माध्यम पाश्चात्य तकनीक से प्रेरित है , परंतु भारतीय इतिहास गवाह है कि देवर्षि नारद पहले समाचार वाचक माने जाते हैं।  महाभारत काल में संजय की कल्पना जिसने युद्ध का आंखों देखा वर्णन धृतराष्ट्र को सुनाया था एक समृद्ध संचार व्यवस्था की ओर इशारा करता है।

जनसंचार के आधुनिक माध्यम

समाचार पत्र , पत्रिका , टेलीविजन , सिनेमा और इंटरनेट आदि।

जनसंचार की मजबूत कड़ी समाचार पत्र , पत्रिका या प्रिंट माध्यम है। यही समाचारों के आदान-प्रदान का मुख्य साधन माना जाता है।  पत्रकारिता के तीन पहलू हैं – पहला समाचार को संकलित करना , दूसरा उन्हें संपादित कर छपने लायक बनाना , तीसरा पत्र या पत्रिका के स्वरूप में छाप कर पाठकों तक पहुंचाना।

संवादाता जो खबरें एकत्रित करके लाता है , उन्हें व्यवस्थित ढंग से छापने का काम संपादक करता है।

400 साल पहले ही अखबारी पत्रकारिता अस्तित्व में आई परंतु भारत में इसकी शुरुआत 1780 में जेम्स ऑगस्ट हिकी के बंगाल गजट से हुई। जो कोलकाता से निकला था हिंदी का पहला सप्ताहिक पत्र उदंड मार्तंड भी 1826 में कोलकाता से ही प्रकाशित हुआ। जिसका संपादन पंडित जुगल किशोर शुक्ल ने किया था।

भारतेंदु जी ने बहुत सी पत्र – पत्रिकाएं निकालकर इस क्षेत्र में विशेष योगदान दिया।

स्वतंत्रता से पूर्व पत्रकारों में गणेश शंकर विद्यार्थी , माखनलाल चतुर्वेदी , प्रताप नारायण मिश्र , शिवपूजन सहाय , रामवृक्ष बेनीपुरी और बालमुकुंद गुप्त है।

प्रमुख पत्र पत्रिकाएं

केसरी , हिंदुस्तान , सरस्वती , हंस , कर्मवीर , प्रताप प्रदीप और विशाल भारत आदि है।

आजादी के बाद प्रमुख पत्रकारों में सच्चिदानंद हीरानंद वात्सायन , रघुवीर सहाय , धर्मवीर भारती , मनोहर श्याम जोशी , राजेंद्र माथुर आदि है।

समाचार पत्र –

  • नवभारत टाइम्स ,
  • जनसत्ता ,
  • नईदुनिया ,
  • अमर उजाला ,
  • दैनिक जागरण आदि है।

पत्रिकाएं –

  • धर्मयुग ,
  • साप्ताहिक हिंदुस्तान ,
  • दिनमान ,
  • इंडिया टुडे और सप्ताहिक कादंबिनी है।

रेडियो ( जनसंचार के आधुनिक माध्यम )

रेडियो जनसंचार का श्रव्य माध्यम है , जो सर्वाधिक लोकप्रिय है।

1895 में इटली के जी मारकोनी ने वायरलेस की खोज की और उसी का रूपांतरण रेडियो है।

1921 में मुंबई में टाइम्स ऑफ इंडिया डाक तार विभाग की ओर से संगीत कार्यक्रम प्रकाशित हुआ।

1936 में ऑल इंडिया रेडियो की स्थापना हुई ,

आज देश में लगभग 350 से अधिक निजी रेडियो स्टेशन का जाल बिछ गया है।

टेलिविजन ( जनसंचार के आधुनिक माध्यम )

यह दृश्य – श्रव्य माध्यम है। उसकी विश्वसनीयता सर्वाधिक है।

1927 में बेल टेलीफोन लैबोरेट्रीज न्यूयॉर्क और वॉशिंगटन के बीच प्रायोगिक टेलीविजन कार्यक्रम का प्रसारण किया। 1936 में बी.बी.सी ने अपनी सेवा प्रारंभ की शुरुआत 15 सितंबर 1959 में हुई जिसका उद्देश्य शिक्षा के सामुदायिक विकास को प्रोत्साहित करना था।

15 अगस्त 1965 में स्वतंत्रता दिवस से विधिवत टेलीविजन सेवा प्रारंभ हुई।

1 अप्रैल 1976 से इसे आकाशवाणी से अलग कर दिया गया।

जनतंत्र को प्रबल बनाने में जहां समाज पुराने मूल्य टूटे हो और नए ना बन रहे हो दूरदर्शन महत्वपूर्ण भूमिका निभा रहा है।

सिनेमा ( जनसंचार के आधुनिक माध्यम )

मनोरंजन के साथ-साथ परोक्ष रूप में सूचना ज्ञान और संदेश देने का काम करता है।  सिनेमा का आविष्कार का श्रेय थॉमस अल्वा एडिसन को  जाता है। 1894 में फ्रांस में पहली फिल्म द अराइवल ऑफ ट्रेन बनी। भारत में पहली मूक फिल्म 1913 में राजा हरिश्चंद्र दादा साहब फाल्के द्वारा बनाई गई।  1931 में पहली बोलती फिल्म आलम आरा बनी , इस समय भारत विश्व का सबसे बड़ा फिल्म निर्माता देश है।

यहां हिंदी के अतिरिक्त क्षेत्रीय भाषा और बोली में भी फिल्में बनती है।

इंटरनेट ( जनसंचार के आधुनिक माध्यम )

इंटरनेट जनसंचार का सबसे आधुनिक और लोकप्रिय माध्यम है।  रेडियो , टेलीविजन , किताब सिनेमा यहां तक कि इसमें पुस्तकालय के सारे गुण मौजूद है। यह एक अंतर क्रियात्मक माध्यम है। जिसमें प्रयोगकर्ता नहीं है , वह चर्चा बातचीत का एक हिस्सा होता है। इंटरनेट ने संचार की नई संभावनाएं जगा दी है , हमें विश्वग्राम का सदस्य बना दिया है। अश्लील पन्नों हुआ अपराधिक गतिविधियों के कारण इसके दुरुपयोग की घटनाएं सामने आने लगी है।

जनसंचार माध्यमों का प्रभाव

जनसंचार माध्यमों के बिना जीवन की कल्पना नहीं कर सकते हैं। अखबार पढ़े बिना हमारी सुबह नहीं होती , रेडियो , टेलीविजन मनोरंजन के साथ-साथ समाचार ज्ञान विज्ञान बाजार भाव विज्ञापन देते हैं। इंटरनेट का प्रयोग शादी – विवाह के लिए टिकट बुक करवाने के लिए कोई बिल जमा कराने बैंक में काम घर से करने के लिए करते हैं ऐसा लगता है कि पूरी दुनिया नेट पर निर्भर है। सदुपयोग के साथ-साथ दुरुपयोग भी हो रहा है। नेट क्राइम बढ़ता जा रहा है , जहां सिनेमा , टीवी वास्तविकता से परे काल्पनिक दुनिया में पहुंचा देते हैं वहीं हुए अपराधों के नए-नए तरीके सिखा देते हैं।

हिंसा और अश्लीलता युवा वर्ग को प्रभावित करती है।

विज्ञापनों के जाल में मनुष्य फंस जाता है। अखबार और टेलीविजन चैनलों में कुछ खास मुद्दों को उछाला जाता है , कुल मिलाकर हम कह सकते हैं कि जहां एक और लोग शिक्षित सचेत और जागरूक हो रहे हैं वहीं नकारात्मक प्रभाव उन्हें भ्रमित पथभ्रष्ट और चरित्र पर प्रभाव डाल रहे हैं।

एक जागरूक पाठक श्रोता होने के नाते हमें आंखें , कान और दिमाग सदा खुले रहने चाहिए।

जनसंचार माध्यमों की एक महत्वपूर्ण विशेषता यह भी है कि उसमें अनेक द्वारपाल गेटकीपर कार्य करते हैं। द्वारपाल का कार्य जनसंचार से प्रकाशित या प्रसारित होने वाली सामग्री को नियंत्रित एवं निर्धारित करना है। किसी जनसंचार माध्यम में काम करने वाले द्वारपाल ही निश्चित करते हैं कि वह किस प्रकार की सामग्री प्रकाशित व प्रसारित की जाएगी।

जनसंचार माध्यम प्रश्न उत्तर

प्रश्न – संचार से आप क्या समझते हैं ?

उत्तर – संचार ‘चर’ धातु से बना है जिसका अर्थ है चलना अर्थात जो साथ साथ चले वह संचार है।

प्रश्न – फीडबैक क्या है ?

उत्तर – फीडबैक जनसंचार का एक प्रक्रिया है। जनसंचार करते समय हमें यह पुष्टि करने के लिए कि हमारा संदेश दूसरे व्यक्ति तक ठीक प्रकार से पहुंचा उसमें कोई त्रुटि या सुधार की आवश्यकता है , इसके लिए फीडबैक का सहारा लिया जाता है।

फीडबैक के द्वारा हम सुधार कर सकते हैं।

प्रश्न  –  जनसंचार में द्वारपाल की क्या भूमिका है ?

उत्तर – जनसंचार में द्वारपाल की संख्या बहुत अधिक होती है। वह किसी भी सूचना प्रकाशन आदि का पूरा दायित्व ग्रहण करते हैं। जनसंचार के लिए द्वारपाल की भूमिका को नजरअंदाज नहीं किया जा सकता।

प्रश्न – द्वारपाल किसे कहते हैं ?

उत्तर – जनसंचार के क्षेत्र में द्वारपाल संपादक को कहते हैं।  संपादक ही अपने अखबार में किसको छापना है किसको नहीं छापना है किसको कितना महत्व देना है इस प्रकार के महत्वपूर्ण निर्णय लेता है। और अपने पत्र पत्रिका समाचार आदि का सुचारू रूप से प्रकाशन कर पाता है।

प्रश्न – पहला समाचार वाचक किसे माना गया है ?

उत्तर –  देवर्षि नारद को पहला समाचार वाचक माना गया है।

प्रश्न – भारत में पहली फिल्म बनाने का श्रेय किसको जाता है ?

उत्तर – भारत में पहला फिल्म बनाने का श्रेय दादा साहब फाल्के को जाता है।

Read More

Chapter 8: Communication Open Source Concept | class 12th | revision notes computer science

Communication And open source Network Notes Class 12 Computer Science

class_12_computer_concept_16
class_12_computer_concept_16a
class_12_computer_concept_16b
class_12_computer_concept_16c

Basic communications media types

· Copper

o unshielded twisted pair (utp)

o shielded twisted pair (stp)

o coaxial cable (thinnet, thicknet)

· Fiber optic

o single-mode

o multi-mode

· Infrared

· Radio & microwave

Twisted Pair Cable
· These cables consist of two insulated copper wires twisted around each other in a double helix.

· Twisting of wires reduces crosstalk which is bleeding of a signal from one wire to another.

Types:
· Unshielded Twisted Pair (UTP)

· Shielded Twisted Pair (STP

STP offers greater protection from interference and crosstalk due to shielding.

But it is heavier and costlier than UTP.

USE 1. In local telephone communication

2. For digital data transmission over short distances upto 1 km

Advantages:
· Easy to install and maintain

· Simple

· Inexpensive

· Low weight

· Suitable for small (Local) Networks

Disadvantages:
· Not suitable for long distance due to high attenuation.

· Low bandwidth support.

· Low Speed

Coaxial cable
· Coaxial cable consists of a solid copper wire core surrounded by a plastic cladding shielded in a wire mesh.

· Shield prevents the noise by redirecting it to ground.

CBSE Class 12 Computer Science - Communication And Network Concepts

Types:
Coaxial cable comes in two sizes which are called thinnet and thicknet.

· Thicknet : segment length upto 500 m

· Thinnet : segment length upto 185 m

USE:
In TV channel communication

Advantages:
· Better than twisted wire cable.

· Popular for TV networks

· Offers higher bandwidth & Speed

· Disadvantages:

· Expensive than twisted wires.

· Not compatible with twisted wire cable.

Optical Fibres
· Thin strands of glass or glass like material designed to carry light from one source to another.

· Source converts (Modulates) the data signal into light using LED (Light Emitting Diodes) or LASER diodes and send it over the Optical fiber.

It consists of three parts:
1. The core: glass or plastic through which the light travels.

2. The cladding : covers the core and reflects light back to the core

3. Protective coating : protects the fiber

Advantages
· Not affected by any kind of noise.

· High transmission capacity

· Speed of Light

· Suitable for broadband communication

Disadvantages
· Installation requires care.

· Connecting two Optical fibers is difficult.

· Optical fibers are more difficult to solder

· Most expensive

Microwaves
Microwaves are transmitted from the transmitters placed at very high towers to the receivers at a long distance.

CBSE Class 12 Computer Science - Communication And Network Concepts

Advantages
• Maintenance easy than cables.

• Suitable when cable can not be used.

Disadvantages
• Repeaters are required for long distance communication.

• Less Bandwidth available

Satellite
Geostationary satellites are placed around 36000 KM away from the earth’s surface. In satellite communication transmitting station transmits the signals to the satellite. (It is called up-linking). After receiving the signals (microwaves) it amplifies them and transmit back to earth in whole visibility area.

Receiving stations at different places can receive these signals. (It is called down-linking).

CBSE Class 12 Computer Science - Communication And Network Concepts

Advantage

• Area coverage is too large

Disadvantage

• High investment

Network devices

Modem

· A modem is a computer peripheral that allows you to connect and communicate with other computers via telephone lines.
· Modem means Modulation/ Demodulation.
· Modulation: A modem changes the digital data from your computer into analog data, a format that can be carried by telephone lines.

· Demodulation: The modem receiving the call then changes the analog signal back into digital data that the computer can digest.

· The shift of digital data into analog data and back again, allows two computers to speak with one another.

RJ- 45 Connector

RJ-45 is short for Registered Jack-45. It is an eight wire connector which is commonly used to connect computers on the local area networks i.e., LAN.

Network Interface Cards (Ethernet Card)

· A network card, network adapter or NIC (network interface card) is a piece of computer hardware designed to allow computers to communicate over a computer network. It provides physical access to a networking medium and often provides a low-level addressing system through the use of MAC addresses. It allows users to connect to each other either by using cables or wirelessly.

CBSE Class 12 Computer Science - Communication And Network Concepts

A repeater is an electronic device that receives a signal and retransmits it at a higher level or higher power, or onto the other side of an obstruction, so that the signal can cover longer distances without degradation. In most twisted pair Ethernet configurations, repeaters are required for cable runs longer than 100 meters.

Read More

Chapter 7: Boolean Algebra | class 12th | revision notes computer science

Boolean algebra is the category of algebra in which the variable’s values are the truth values, true and false, ordinarily denoted 1 and 0 respectively. It is used to analyze and simplify digital circuits or digital gates. It is also called Binary Algebra or logical Algebra. It has been fundamental in the development of digital electronics and is provided for in all modern programming languages. It is also used in set theory and statistics.

The important operations performed in Boolean algebra are – conjunction (∧), disjunction (∨) and negation (¬). Hence, this algebra is far way different from elementary algebra where the values of variables are numerical and arithmetic operations like addition, subtraction is been performed on them.

Boolean Algebra Operations

The basic operations of Boolean algebra are as follows:

  • Conjunction or AND operation
  • Disjunction or OR operation
  • Negation or Not operation

Below is the table defining the symbols for all three basic operations.

OperatorSymbolPrecedence
NOT‘ (or) ¬Highest
AND. (or) ∧Middle
OR+ (or) ∨Lowest

Suppose A and B are two Boolean variables, then we can define the three operations as;

  • A conjunction B or A AND B, satisfies A ∧ B = True, if A = B = True or else A ∧ B = False.
  • A disjunction B or A OR B, satisfies A ∨ B = False, if A = B = False, else A ∨ B = True.
  • Negation A or ¬A satisfies ¬A = False, if A = True and ¬A = True if A = False

Boolean Expression

A logical statement that results in a Boolean value, either be True or False, is a Boolean expression. Sometimes, synonyms are used to express the statement such as ‘Yes’ for ‘True’ and ‘No’ for ‘False’. Also, 1 and 0 are used for digital circuits for True and False, respectively.

Boolean expressions are the statements that use logical operators, i.e., AND, OR, XOR and NOT. Thus, if we write X AND Y = True, then it is a Boolean expression.

Boolean Algebra Terminologies

Now, let us discuss the important terminologies covered in Boolean algebra.

Boolean Algebra: Boolean algebra is the branch of algebra that deals with logical operations and binary variables.

Boolean Variables: A Boolean variable is defined as a variable or a symbol defined as a variable or a symbol, generally an alphabet that represents the logical quantities such as 0 or 1.

Boolean Function: A Boolean function consists of binary variables, logical operators, constants such as 0 and 1, equal to the operator, and the parenthesis symbols.

Literal: A literal may be a variable or a complement of a variable.

Complement: The complement is defined as the inverse of a variable, which is represented by a bar over the variable.

Truth Table: The truth table is a table that gives all the possible values of logical variables and the combination of the variables. It is possible to convert the Boolean equation into a truth table. The number of rows in the truth table should be equal to 2n, where “n” is the number of variables in the equation. For example, if a Boolean equation consists of 3 variables, then the number of rows in the truth table is 8. (i.e.,) 23 = 8.

Boolean Algebra Truth Table

Now, if we express the above operations in a truth table, we get;

ABA ∧ BA ∨ B
TrueTrueTrueTrue
TrueFalseFalseTrue
FalseTrueFalseTrue
FalseFalseFalseFalse
A¬A
TrueFalse
FalseTrue

Boolean Algebra Rules

Following are the important rules used in Boolean algebra.

  • Variable used can have only two values. Binary 1 for HIGH and Binary 0 for LOW.
  • The complement of a variable is represented by an overbar.Thus, complement of variable B is represented as B¯. Thus if B=0 then B¯=1 and B =1 then B¯=0.
  • OR-ing of the variables is represented by a plus (+) sign between them. For example, the OR-ing of A, B, and C is represented as A + B + C.
  • Logical AND-ing of the two or more variables is represented by writing a dot between them, such as A.B.C. Sometimes, the dot may be omitted like ABC.

Laws of Boolean Algebra

There are six types of Boolean algebra laws. They are:

  • Commutative law
  • Associative law
  • Distributive law
  • AND law
  • OR law
  • Inversion law

Those six laws are explained in detail here.

Commutative Law

Any binary operation which satisfies the following expression is referred to as a commutative operation. Commutative law states that changing the sequence of the variables does not have any effect on the output of a logic circuit.

  • A. B = B. A
  • A + B = B + A

Associative Law

It states that the order in which the logic operations are performed is irrelevant as their effect is the same.

  • ( A. B ). C = A . ( B . C )
  • ( A + B ) + C = A + ( B + C)

Distributive Law

Distributive law states the following conditions:

  • A. ( B + C) = (A. B) + (A. C)
  • A + (B. C) = (A + B) . ( A + C)

AND Law

These laws use the AND operation. Therefore they are called AND laws.

  • A .0 = 0
  • A . 1 = A
  • A. A = A
  • A.A¯=0

OR Law

These laws use the OR operation. Therefore they are called OR laws.

  • A  + 0 = A
  • A + 1 = 1
  • A + A = A
  • A+A¯=1

Inversion Law

In Boolean algebra, the inversion law states that double inversion of variable results in the original variable itself.

  • A¯¯=A

Boolean Algebra Theorems

The two important theorems which are extremely used in Boolean algebra are De Morgan’s First law and De Morgan’s second law. These two theorems are used to change the Boolean expression. This theorem basically helps to reduce the given Boolean expression in the simplified form. These two De Morgan’s laws are used to change the expression from one form to another form. Now, let us discuss these two theorems in detail.

De Morgan’s First Law:

De Morgan’s First Law states that  (A.B)’ = A’+B’.

The first law states that the complement of the product of the variables is equal to the sum of their individual complements of a variable.

The truth table that shows the verification of De Morgan’s First law is given as follows:

ABA’B’(A.B)’A’+B’
001111
011011
100111
110000

The last two columns show that (A.B)’ = A’+B’.

Hence, De Morgan’s First Law is proved.

De Morgan’s Second Law:

De Morgan’s Second law states that (A+B)’ = A’. B’.

The second law states that the complement of the sum of variables is equal to the product of their individual complements of a variable.

The following truth table shows the proof for De Morgan’s second law.

ABA’B’(A+B)’A’. B’
001111
011000
100100
110000

The last two columns show that (A+B)’ = A’. B’.

Hence, De Morgan’s second law is proved.

 The other theorems in Boolean algebra are complementary theorem, duality theorem, transposition theorem, redundancy theorem and so on. All these theorems are used to simplify the given Boolean expression. The reduced Boolean expression should be equivalent to the given Boolean expression.

Solved Examples

Question: Simplify the following expression: c+BC¯

Solution:

Given: C+BC¯

According to Demorgan’s law, we can write the above expressions asC+(B¯+C¯)

From Commutative law:(C+C¯)+B¯

From Complement law1+B¯=1

Therefore, C+BC¯=1

Question 2: Draw a truth table for A(B+D).

Solution: Given expression A(B+D).

ABDB+DA(B+D)
00000
00110
01010
01110
10000
10111
11011
11111

Stay tuned with BYJU’S – The Learning App and also explore more videos.

Frequently Asked Questions on Boolean Algebra

What is meant by Boolean algebra?

In Mathematics, Boolean algebra is called logical algebra consisting of binary variables that hold the values 0 or 1, and logical operations.

What are some applications of Boolean algebra?

In electrical and electronic circuits, Boolean algebra is used to simplify and analyze the logical or digital circuits.

What are the three main Boolean operators?

The three important Boolean operators are:
AND (Conjunction)
OR (Disjunction)
NOT (Negation)

Is the value 0 represents true or false?

In Boolean logic, zero (0) represents false and one (1) represents true. In many applications, zero is interpreted as false and a non-zero value is interpreted as true.

Mention the six important laws of Boolean algebra.

The six important laws of Boolean algebra are:
Commutative law
Associative law
Distributive law
Inversion law
AND law
OR law

Read More

Chapter 6: Database & SQL | class 12th | revision notes computer science

Database And SQL Notes Class 12 Computer Science

class_12_computer_concept_10
class_12_computer_concept_10a
class_12_computer_concept_10c
class_12_computer_concept_10b

5. LONG

This data type is used to store variable length strings of upto 2 GB size.

e.g                 description long;

6. RAW/LONG RAW

To store binary data (images/pictures/animation/clips etc.) RAW or LONG RAW data type is used. A

column LONG RAW type can hold upto 2 GB of binary data.

e.g                image raw(2000);

SQL Commands

a.                CREATE TABLE Command:

Create table command is used to create a table in SQL. It is a DDL type of command. The general syntax of creating a table is

Creating Tables
The syntax for creating a table is

create table <table> (

<column 1> <data type> [not null] [unique] [<column constraint>],

. . . . . . . . .

<column n> <data type> [not null] [unique] [<column constraint>],

[<table constraint(s)>]

); For each column, a name and a data type must be specified and the column name must be unique within the table definition. Column definitions are separated by comma. Uppercase and lowercase letters makes no difference in column names, the only place where upper and lower case letters matter are strings comparisons. A not null Constraint means that the column cannot have null value, that is a value needs to be supplied for that column. The keyword unique specifies that no two tuples can have the same attribute value for this column.

Operators in SQL:

The following are the commonly used operators in SQL

1. Arithmetic Operators +, -, *, /

2. Relational Operators =, <, >, <=, >=, <>

3. Logical Operators OR, AND, NOT

Arithmetic operators are used to perform simple arithmetic operations.

Relational Operators are used when two values are to be compared and Logical operators are used to connect search conditions in the WHERE Clause in SQL.

Constraints:

Constraints are the conditions that can be enforced on the attributes of a relation. The constraints come in play when ever we try to insert, delete or update a record in a relation.

       1. NOT NULL

       2. UNIQUE

       3. PRIMARY KEY

       4. FOREIGN KEY

       5. CHECK

       6. DEFAULT

Not null ensures that we cannot leave a column as null. That is a value has to be supplied for that column.

e.g               name varchar(25) not null;

Unique constraint means that the values under that column are always unique.

e.g              Roll_no number(3) unique;

Primary key constraint means that a column can not have duplicate values and not even a null value.

e.g.             Roll_no number(3) primary key;

The main difference between unique and primary key constraint is that a column specified as unique may have null value but primary key constraint does not allow null values in the column.

Foreign key is used to enforce referential integrity and is declared as a primary key in some other table.

e.g               cust_id varchar(5) references master(cust_id);

it declares cust_id column as a foreign key that refers to cust_id field of table master. That means we

cannot insert that value in cust_id filed whose corresponding value is not present in cust_id field of master table.

Check constraint limits the values that can be inserted into a column of a table.

e.g                  marks number(3) check(marks>=0);

The above statement declares marks to be of type number and while inserting or updating the value in marks it is ensured that its value is always greater than or equal to zero.

Default constraint is used to specify a default value to a column of a table automatically. This default value will be used when user does not enter any value for that column.

e.g balance number(5)            default = 0;

CREATE TABLE student (

Roll_          no number(3) primary key,

Name         varchar(25) not null,

Class          varchar(10),

Marks         number(3) check(marks>0),

City           varchar(25) );

Data Modifications in SQL

After a table has been created using the create table command, tuples can be inserted into the table,

or tuples can be deleted or modified.

INSERT Statement

The simplest way to insert a tuple into a table is to use the insert statement

insert into <table> [(<column i, . . . , column j>)] values (<value i, . . . , value j>);

INSERT INTO student VALUES(101,’Rohan’,’XI’,400,’Jammu’);

While inserting the record it should be checked that the values passed are of same data types as the one which is specified for that particular column.

For inserting a row interactively (from keyboard) & operator can be used.

e.g INSERT INTO student VALUES(&Roll_no’,’&Name’,’&Class’,’&Marks’,’&City’);

In the above command the values for all the columns are read from keyboard and inserted into the table student.

NOTE:- In SQL we can repeat or re-execute the last command typed at SQL prompt by typing “/” key and pressing enter.

Queries:

To retrieve information from a database we can query the databases. SQL SELECT statement is used to select rows and columns from a database/relation.

SELECT Command

This command can perform selection as well as projection.

Selection:     This capability of SQL can return you the tuples form a relation with all the attributes.

Projection:    This is the capability of SQL to return only specific attributes in the relation.

*        SELECT * FROM student; command will display all the tuples in the relation student 

*        SELECT * FROM student WHERE Roll_no <=102;

The above command display only those records whose Roll_no less than or equal to 102.

Select command can also display specific attributes from a relation.

*         SELECT name, class FROM student;

The above command displays only name and class attributes from student table.

*        SELECT count(*) AS “Total Number of Records” FROM student;

Display the total number of records with title as “Total Number of Records” i.e an alias We can also use arithmetic operators in select statement, like

*       SELECT Roll_no, name, marks+20 FROM student;

*       SELECT name, (marks/500)*100 FROM student WHERE Roll_no > 103;

Eliminating Duplicate/Redundant data

DISTINCT keyword is used to restrict the duplicate rows from the results of a SELECT statement.

e.g.            SELECT DISTINCT name FROM student;

The above command returns

            Name

           Rohan

           Aneeta Chopra

           Pawan Kuma

Conditions based on a range

SQL provides a BETWEEN operator that defines a range of values that the column value must fall for the condition to become true.

e.g.         SELECT Roll_no, name FROM student WHERE Roll_no BETWENN 100 AND 103;

The above command displays Roll_no and name of those students whose Roll_no lies in the range 100 to 103 (both 100 and 103 are included in the range).

Conditions based on a list

To specify a list of values, IN operator is used. This operator select values that match any value in the given list.

e.g. SELECT * FROM student WHERE city IN (‘Jammu’,’Amritsar’,’Gurdaspur’);

The above command displays all those records whose city is either Jammu or Amritsar or Gurdaspur.

Conditions based on Pattern

SQL provides two wild card characters that are used while comparing the strings with LIKE operator.

a.               percent(%) Matches any string

b.              Underscore(_) Matches any one character

e.g            SELECT Roll_no, name, city FROM student WHERE Roll_no LIKE “%3”;

displays those records where last digit of Roll_no is 3 and may have any number of characters in front.

e.g              SELECT Roll_no, name, city FROM student WHERE Roll_no LIKE “1_3”;

displays those records whose Roll_no starts with 1 and second letter may be any letter but ends with digit 3.

ORDER BY Clause

ORDER BY clause is used to display the result of a query in a specific order(sorted order).

The sorting can be done in ascending or in descending order. It should be kept in mind that the actual data in the database is not sorted but only the results of the query are displayed in sorted order.
e.g.            SELECT name, city FROM student ORDER BY name;

The above query returns name and city columns of table student sorted by name in increasing/ascending order.

e.g.            SELECT * FROM student ORDER BY city DESC;

It displays all the records of table student ordered by city in descending order.

Note:- If order is not specifies that by default the sorting will be performed in ascending order.

GROUP BY Clause

The GROUP BY clause can be used in a SELECT statement to collect data across multiple records and group the results by one or more columns.

The syntax for the GROUP BY clause is:

SELECT column1, column2, … column_n, aggregate_function (expression)

FROM tables

WHERE conditions

GROUP BY column1, column2, … column_n;

aggregate_function can be a function such as SUM, COUNT, MAX, MIN, AVG etc.

e.g     SELECT name, COUNT(*) as “Number of employees”

          FROM student

          WHERE marks>350

          GROUP BY city;

HAVING Clause

The HAVING clause is used in combination with the GROUP BY clause. It can be used in a SELECT statement to filter the records that a GROUP BY returns.

The syntax for the HAVING clause is:

SELECT column1, column2, … column_n, aggregate_function (expression)

FROM tables

WHERE predicates

GROUP BY column1, column2, … column_n

HAVING condition1 … condition_n;

e.g     SELECT SUM(marks) as “Total marks”

          FROM student

         GROUP BY department

         HAVING SUM(sales) > 1000;

Read More

Chapter 5: Data Structures class 12th revision notes computer science

:Data-Structures:-

• The logical or mathematical model of a particular organization of data is called data structure. It is a way of storing, accessing, manipulating data.

• Types of data structure:

Data Structures
|
|-Linear
|   |-Arrays
|   |-Linked List
|   |-Stacks
|   |-Queues
|
|-Non-Linear
    |- Trees
    |- Graphs
    |- Tables
    |- Sets


• Operation on data structure:

Traversing: – Accessing each record exactly once.
Insertion: – Adding a new element to the structure.
Deletion: – Removing element from the structure.
Searching: – Search the element in a structure.
Sorting: – Arrange the elements in ascending and descending order.
Merging: – Joining two data structures of same type.

• List: – An array or list is the collection of elements in ordered way.

• There are two types of arrays:
– One dimensional list (1-D Lists)
– Multi-dimensional list (Nested Lists)

• Traversing 1-D array (List):

L = [10, 20, 30, 40, 50]
for i in L:
    print (i)


Output:

10
20
30
40
50
>>>

• Inserting Element in a list: There are two ways to insert an element in a list.
– If the array is not sorted
– If the array is sorted

• If the array is not sorted: In this case, enter the element at any position using insert() function or add the element in the last of the array using append() function.

Example:

L = [15, 8, 25, 45, 13, 19]
L.insert(3,88) # insert element at the index 3
print(L)
 
Output:
[15, 8, 25, 88, 45, 13, 19]

• If the array is sorted: In this case, import bisect module and use the functions bisect() and insort(). bisect(): identifies the correct index for the element and returns the index. insort(): Inserts the element in the list in its correct order.

• Deletion of an element from a List: To delete an element from a list we can use remove() or pop() method.

Example:

L= [10, 15, 35, 12, 38, 74, 12]
val=int(input("Enter the element that you want to delete: "))
print ("List Before deletion of element: ", L)
L.remove(val)
print("After deletion the element ", val," the list is: ", L)

Output:

Enter the element that you want to delete: 12
List Before deletion of element:  [10, 15, 35, 12, 38, 74, 12]
After deletion the element 12 the list is:  [10, 15, 35, 38, 74, 12]
>>>

• Searching in a List: There are two types of searching techniques we can use to search an element in a list. These are:
– Linear Search
-Binary Search

(i) Linear Search: It is a simple searching technique.

Program:

L = eval(input("Enter the elements: "))
n = len(L)
item = eval(input("Enter the element that you want to search: "))
count = 0
for i in range(n):
    if L[i]==item:
        print("Element found at the position :", i+1)
        count += 1
        break
if count == 0:
    print("Element not Found")

Output:

Enter the elements: 5,3,9,6,8,7,1
Enter the element that you want to search: 6
Element found at the position: 4
>>>

(ii) Binary Search:

Binary search can work for only sorted arrays whereas linear search can work for both sorted as well as unsorted arrays.

You can understand binary search method by following program: –

def bisearch (ar, key):
    low = 0
    high = len(ar)-1
    while low <= high :
        mid = int ((low+high)/2)
        if key == ar[mid]:
            return mid
        elif key < ar [mid]:
            high = mid - 1
        else :
            low = mid +1
    else :    # loop else
        return -999
ar = [12,16,19,21,26,59,86,92,97]
item = int (input("Enter search item : " ))
res = bisearch(ar , item)
if res >= 0:
    print (item , "FOUND at index ", res+1)
else :
    print ("Sorry ! ",item ,"Not FOUND in array")

Output:

Enter search item: 19
19 FOUND at index 2
>>>

Linear Search
– Access of elements sequentially.
– Elements may or may not be in sorted order.
– Takes more time to search an element.
– Easy
– Efficient for small array.

Binary Search

– Access of elements randomly.
– Elements must be in sorted order i.e. ascending or descending order
– Takes less time to search an element.
– Tricky
– Efficient for larger array

• Sorting: To arrange the elements in ascending or descending order. There are many sorting techniques.

Program:

L = eval(input("Enter the elements:"))
n=len(L)
for p in range(0, n-1):
    for i in range(0, n-1):
        if L[i] > L[i+1]:
            L[i], L[i+1] = L[i+1], L[i]
print("The sorted list is : ", L)

Output:

Enter the elements:[5,3,26,4,9]
The sorted list is:  [3, 4, 5, 9, 26]
>>>

• Stack: It is a linear data structure. Stack is a list of elements in which an element may be inserted or deleted only at one end, called the TOP of the stack. It follows the principle Last in First out (LIFO).

• There are two basic operations associated with stack: –
– Push: Insert the element in stack
– Pop: Delete the element from stack

• Menu based program for stack:

S= []
from os import system
#menu display
def menu():
    ch = 0
    while(ch<1 or ch>4):
        #print("\n" 100)
        anyvar = system("cls")
        print("\n\n\n\n\n")
        print ("\t\t\t1: PUSH")
        print ("\t\t\t2: POP")
        print ("\t\t\t3: DISPLAY")
        print("\t\t\t4: EXIT")
        ch = int(input("\n\t\tEnter a choise (1- 4):"))
    return ch

def push():
    #code to push an item
    item = int(input("\t\t\tEnter an item to push: "))
    S.append(item)
    print("\t\t\t ITEM", item," PUSHESD IN THE STACK")

def pop():
    #code to pop from stack
    if (S ==  []):
        prínt ("\t\t\t NO ITEM TO POP")
    else:
        item = S.pop()
        print ("\t\t\t ITEM ", item," POPPED FROM THE STACK")

def display():
    #code to display stack
    if (S== []):
        print ("\t\t\tEMPTY STACK")
    else:
        print ("\t\t\t",)
        for i in S:
            print( i, '', end="")

#code to call all functions

import sys
ch = 0

while(ch != 4):
    ch=menu()
    if(ch == 1):
        push()
    elif(ch == 2):
        pop()
    elif(ch == 3):
        display()
    elif(ch == 4):
        print ("\t\t\t ABORTING PROGRAM.")
        sys.exit()
        anyvar = input("\n\t\t\tPress any key to continue... \n")

• QUEUE: Queue is a linear data structure. Queue is a list of elements in which insertion takes place at one end called REAR and deletion takes place only at the other end, called the FRONT. It follows the principle First In First Out (FIFO).

• There are two basic operations associated with stack:
– Enqueue: Insert the element in queue
– Dequeue : Delete the element from queue.

• Menu based program for queue:

Q = []
from os import system
#menu display
def menu():
    ch = 0
    while(ch<1 or ch>4):
        #print ("\n"*100)
        anyvar = system("cls")
        print ("\n\n\n\n\n")
        print ("\t\t\t1: INSERT")
        print ("\t\t\t2: DELETE")
        print ("\t\t\t3: DISPLAY")
        print ("\t\t\t4: EXIT")
        ch = int(input("\n\t\t\tEnter a choise (1-4): "))
    return ch

def insert():
    #code to insert an item
    item = int(input("\t\t\tEnter an item to insert: "))
    Q.append(item)
    print("\t\t\tITEM", item," INSERTED IN THE QUEUE")

def delete():
    #code to delete from queue
    if (Q == []):
        print ("\t\t\tNO ITEM TO DELETE")
    else:
        item = Q.pop(0)
        print ("\t\t\t ITEM", item," DELETED FROM THE QUEUE")

def display():
    #code to display stack
    if (Q == [] ):
        print ("\t\t EMPTY QUEUE")
    else:
        print ("\t\t\t",)
        for i in Q:
            print (i, '', end = " ")

#code to call all functions
import sys
ch = 0
while(ch != 4):
    ch = menu()
    if(ch == 1):
        insert()
    elif (ch == 2):
        delete()
    elif(ch == 3):
        display()
    elif(ch == 4):
        print("\t\t\tABORTING PROGRAM.")
        sys.exit()
        anyvar = input("\n\t\t\tPress any key to continue... \n")
Read More

Chapter 4: Pointers | class 12th | revision notes computer science

Pointers Notes Class 12 Computer Science

class_12_computer_concept_7
class_12_computer_concept_7a
class_12_computer_concept_7b
class_12_computer_concept_7c

10, 20, 30, 40, 50,

10, 20, 30, 40, 50,

Note: A pointer variable can be used as an array as in above example both *p and p[0] refers to the same variable similarly b[0] and *b refers to the same variable. Again p[1] and *(p+1) are same.

Address calculation method is same for both pointer and array. For example int a[5]={2,4,6,7,9};

int *q=a;

The address of a[index] is calculated as

Base address of a (i.e. address of a[0]) + index * sizeof (data type of a)

for example if the base address of a is 1000 then address of a[3] is calculated as

&a[3] =1000 + 3 * sizeof (int) = 1000 + 3 * 2=1000 + 6 = 1006

Note that a[3] and *&a[3] both will give the same value i.e. 7

Similarly address of (q+3) is calculated as

Address stored in q + 3 * sizeof (data type of pointer belongs to in this case int) (q+3) = 1000 + 3 * sizeof (int) = 1000 + 3 * 2=1006

Arithmetic operation on pointers

We can increment or decrement a pointer variable for example float a[5]={3.0,5.6,6.0,2.5,5.3};

float *p=a;

++p;

–p;

if the base address of a is 1000 then statement ++p will increment the address stored in pointer variable by 4 because p is a pointer to float and size of a float object is 4 byte, since ++p is equivalent to p=p+1 and address of p+1 is calculated as

                      Address stored in p + 1 * sizeof (float)= 1000 + 1 * 4 = 1004.

We can add or subtract any integer number to a pointer variable because adding an integer value to an address makes another address e.g.

void main()

{int p[10]={8,6,4,2,1}; Int *q;

q=p;//address of p[0] is assigned to q assuming p[0] is allocated at memory location 1000 q=q+4;//now q contains address of p[4] i.e. 1000+4*sizeof(int)=1000+4*2= 1008

cout<<*q<<endl;

q=q-2;//now q contains address of p[2] i.e. 1008-2*sizeof (int)=1008-2*2=1004 cout<<*q<<endl;

}

Output is

1

4

Addition of two pointer variables is meaningless.

Subtraction of two pointers is meaningful only if both pointers contain the address of different elements of the same array

For example

void main()

{int p[10]={1,3,5,6,8,9};

int *a=p+1,*b=p+4;

p=p+q; //error because sum of two addresses yields an illegal address int x=b-a; //valid

cout<<x;

}

Output is

3

In the above example if base address of a is 1000 then address of a would be 1002 and address of b would be 1008 then value of b-a is calculated as

(Address stored in b-address stored in a)/sizeof(data type in this case int) (1008-1002)/2=3

Multiplication and division operation on a pointer variable is not allowed

We cannot assign any integer value other than 0 to a pointer variable. For example

int *p;

p=5; //not allowed

p=0; //allowed because 0 is a value which can be assigned to a variable of any data type

Null Pointer

A null pointer is a regular pointer of any pointer type which has a special value that indicates that it is not pointing to any valid reference or memory address. This value is the result of type-casting the

integer value zero to any pointer type.

int *q=0; // q has a NULL pointer value float * p;

p=NULL; // p has a NULL (NULL is defined as a constant whose value is 0) pointer value

Note: 0 memory address is a memory location which is not allocated to any variable of the program.

voidpointers

void pointer is a special pointer which can store address of an object of any data type. Since void pointer do not contain the data type information of the object it is pointing to we can not apply dereference operator * to a void pointer without using explicit type casting.

void main()

{

int x=5;

float y=3.5;

int *p;

float *q;

void *r;

p=&y; //error cannot convert float * to int * q=&x; //error cannot convert int * to float * p=&x; //valid

cout<<*p <<endl; //valid q=&y; //valid

cout<<*q<<endl ; //valid

r=&x; //valid

cout<<*r<<endl; //error pointer to cannot be dereference without explicit type cast cout<<*(int *)r<<endl; // valid and display the values pointed by r as int

r=&y; //valid

cout<<*(float *)r<<endl; //valid and display the values pointed by r as float

}

Note: Pointer to one data type cannot be converted to pointer to another data type except pointer to void

Array of pointers and pointer to array

An array of pointer is simply an array whose all elements are pointers to the same data type.
For example

Void main()

{

float x=3.5,y=7.2,z=9.7;

float *b[5]; // here b is an array of 5 pointers to float b[0]=&x;

b[1]=&y;

b[2]=&z;

cout<<*b[0]<<”\t”<<*b[1]<<”\t”<<*b[2]<<endl;

Read More

Chapter 3: Data File Handling | class 12th | revision notes computer science

Data File Handling in Python

Data maintained inside the files is termed as persistent data. It means it is permanent in nature.
Python allow us to read data from and save data to external text files permanently on secondary storage media.

Before we start working with a file, first we need to open it. After performing the desirable operation, it needs to be closed so that resources that are tied in the file are freed.

Data File handling takes place in the following order.

1- Opening a file.
2- Performing operations (read, write) or processing data.
3- Closing the file.

We can process file in several ways, such as:

-> Creating a file

->Traversing a file for displaying data on screen

->Appending data in a file

->Inserting data in a file

->Deleting data in from a file

->Creating a copy of a file

->Updating data in a file

Types of File in Python:

Before we discuss file operation we should be aware of the file types. Python allows us to create and manage three types of data files.

1- Text file

2- Binary file

3- CSV file

File Modes

ModeDescription
rOpens a file for reading only. The file pointer is placed at the beginning of the file. This is the default mode. If the specified file does not exist, it will generate FileNotFoundError.
rbOpens a file for reading only in binary format. The file pointer is placed at the beginning of the file. This is the default mode.
r+Opens a file for both reading and writing. (+) The file pointer will be at the beginning of the file.
rb+Opens a file for both reading and writing in binary format. The file pointer will be at the beginning of the file.
wOpens a file for writing only. Overwrites the file if the file exists. If the file does not exist, it creates a new file for writing.
wbOpens a file for writing only in binary format. Overwrites the file if the file exists. If the file does not exist, creates a new file for writing.
w+Opens a file for both writing and reading. Overwrites the existing file if the file exists. If the file does not exist, creates a new file for reading and writing.
wb+Opens a file for both writing and reading in binary format. Overwrites the existing file if the file exists. If the file does not exist, creates new file for reading and writing.
aOpens a file for appending. The file pointer is at the end of the file if the file exists. That is, the file is in the append mode. If the file does not exist, it creates a new file for writing.
abOpens a file for appending in binary format. The file pointer is at the end of the file if the file exists. That is, the file is in the append mode. If the file does not exist, it creates a new file for writing.
a+Opens a file for both appending and reading. The file pointer is at the end of the file if the file exists. The file opens in the append mode. If the file does not exist, it creates a new file for reading and writing.
ab+Opens a file for both appending and reading in binary format. The file pointer is at the end of the file if the file exists. The file opens in the append mode. If the file does not exist, it creates a new file for reading and writing.

Python Data File Handling

operations on text file

A text file consists of a sequence of lines. A line is a sequence of characters, stored on permanent storage. In a text file, each line is terminated by a special character, known as End Of Line (EOL). Text file can be created using any text editor. Ex. Myfile.txt.

Opening a text file: Open ()

When we want to read or write a file, we must have to open is first. Open () function takes the name of a file as the first argument. The second argument indicates the mode of accessing the file.

Syntax:

<file variable>=open(file name, access mode)

Modes for opening a file:

read(r) : to read the file

write(w): to write the file

append(a):  to write at the end of file

Ex:

>>> f=open(‘myfile.txt’)

>>> print(f)

Output:

<_io.TextIOWrapper name='myfile.txt' mode='r' encoding='cp1252'>

Closing file: close()

Syntax:  file_Object.close()

Example:

f=open(‘myfile.txt’)

print(“The file which is to be open using the given command is:”,f.name)

f.close()

Output:

The file which is to be open using the given command is: myfile.txt

Properties of File Object:

name: shows the file name of opened file

mode: shows Mode in which the file gets opened

readable: returns Boolean value, which indicates whether the file is readable or not

closed: returns Boolean value, which indicates whether the file is closed or not

Example:

f=open(‘myfile.txt’, ‘w’)

print(“Name of File:”,f.name)

print(“Mode of File:”,f.mode)

print(“File readable :”,f.readable())

print(“File closed:”,f.closed)

f.close()

print(“File closed:”,f.closed, f.name)

Output:

Name of File: myfile.txt
Mode of File: w
File readable : False
File closed: False
File closed: True myfile.txt

Reading form a file:

We can read character data from text file by using the following read methods:

read(): To read the entire data from the file; starts reading from the cursor up to the end of the file.

Synatx:

file_Object.read()

Example:

The text file named myfile.txt is already stored in my local disk with the data shown in image.

CBSE file handling

f=open(‘myfile.txt’, ‘r’)

data=f.read()

print(data)

f.close()

Output:

== RESTART: C:/Users/ATC/AppData/Local/Programs/Python/Python38-32/filehandling.py =
Hello,
Welcome to the CBSE class 12 students
Having computer science with python
You are learning Python file handling
>>>

read(n): To read ‘n’ characters from the file, starting from the cursor.

Example: Here we will read only first 21 characters from the file.

f=open(‘myfile.txt’, ‘r’)

data=f.read(21)

print(data)

f.close()

Output:

Hello,
Welcome to the

readline(): To read only one line from the file; starts reading from the cursor up to, and including, the end of line character.

readlines(): To read all lines from the file into a list; starts reading from the cursor up to the end of the file and returns a list of lines.

Read More

Chapter 2: Basic Concepts of OOP Classes & Objects | class 12th | revision notes computer science

Class 12 OOP Classes And Objects Revision Notes

Class 12 OOP Classes And Objects Revision Notes

Class :- A class is collection of data (data member) and functions (member functions or methods) working on the data. It can be seen as a blue print for the object. No memory is allocated when a class is created. Memory is allocated only when an object is created.

Object :- An Object is an instance of the class.

Data member:- The data declared within the class.

Member functions :- Member functions are the methods which are declared/defined inside the class and operate upon the data member.

Data Abstraction: – Data abstraction represents essential features without including background details.

Data Encapsulation:- Binds the data and its functions into a single unit called class.

Data hiding:- Hides internal object details (data members). Data hiding ensures exclusive data access to class members and protects object integrity by preventing unintended or intended changes.

Inheritance: Inheritance is the process of forming a new class from an existing class or base class.

Base Class :- The class from which methods and data members are derived to new class is knows as base class. The base class is also known as parent class or super class.

Derived Class:- The class that is deriving data and methods from base class is called derive class.

Derived class is also known as a child class or sub class.

Polymorphism:- Poly means many and morphs mean form (Multiple Forms). Refers to the ability of processing of data in more than one form.

Access specifier :- private, protected, public (default access specifier is private)

Accessibility of private, protected and public members

Class 12 OOP Classes And Objects Revision Note
Read More

Chapter 1: Overview of CPP | class 12th | revision notes computer science

Introduction To C++ Notes Class 12 Computer Science

class_12_computer_concept_9
class_12_computer_concept_9a
class_12_computer_concept_9b
class_12_computer_concept_9c

Structure-Collection of logically related different data types (Primitive and Derived) referenced under one name.

Nested structure

 A Structure definition within another structure.

  A structure containing object of another structure.

typedef

  Used to define new data type name

#define Directives

  Use to define a constant number or macro or to replace an instruction.

Inline Function

  Inline functions are functions where the call is made to inline functions, the actual code then gets placed in the calling program.

  What happens when an inline function is written?

  The inline function takes the format as a normal function but when it is compiled it is compiled as inline code. The function is placed separately as inline function, thus adding readability to the source program. When the program is compiled, the code present in function body is replaced in the place of function call.

General Format of inline Function:

The general format of inline function is as follows:

inline datatype function_name(arguments)

inline int MyClass( )

Example:

#include <iostream.h>

int MyClass(int);

void main( )

{int x;

cout << “\n Enter the Input Value: ”;

cin>>x;

cout<<”\n The Output is: “ << MyClass(

} inline int MyClass(int x1)

{return 5*x1;}

The output of the above program is:

Enter the Input Value: 10

The Output is: 50

The output would be the same even when the inline function is written solely as a function. The concept, however, is different. When the program is compiled, the code present in the inline function MyClass ( ) is replaced in the place of function call in the calling program. The concept of inline function is used in this example because the function is a small line of code.

The above example, when compiled, would have the structure as follows:

#include <iostream.h>

int MyClass(int);

void main( )

{int x;

cout << “\n Enter the Input Value: ”; cin>>x;

//The MyClass(x) gets replaced with code return 5*x1;

cout<<”\n The Output is: “ << MyClass(x);

}

#include <iostream.h>

int MyClass(int);

void main( )

{int x;

cout << “\n Enter the Input Value: ”;

cin>>x;

//Call is made to the function MyClass

cout<<”\n The Output is: “ << MyClass(x);

}

int MyClass(int x1)

{return 5*x1;}

1 Marks questions

1) Name the header files that shall be needed for the following code:

             void main( )

            { char word[]=”Board Exam”;

            cout<<setw(20)<<word;

            }

2) Name the Header file to which the following built in functions belongs to:

     (i) gets()     (ii) abs()     (iii) sqrt()     (iv) open()

2 Marks questions:

1) Rewrite the following program after removing the syntactical error(s) if any. Underline each correction.

             #include<iostream.h>

             void main( )

            { F = 10, S = 20;

            test(F;S);

           test(S);

           }

          void test(int x, int y = 20)

          { x=x+y;

         count<<x>>y;

          }

2) Find the output of the following program:

        #include<iostream.h>

       void main( )

       { int U=10,V=20;

      for(int I=1;I<=2;I++)

     { cout<<”[1]”<<U++<<”&”<<V 5 <<endl;

    cout<<”[2]”<<++V<<”&”<<U + 2 <<endl; } }

3) Rewrite the following C++ program after removing the syntax error(s) if any. Underline each correction. [CBSE 2010]

include<iostream.h>

       class FLIGHT

      {             Long FlightCode;

                   Char Description[25];

public

                  void addInfo()

                 {             cin>>FlightCode; gets(Description);}

                void showInfo()

{ cout<<FlightCode<<”:”<<Description<<endl;}

};

void main( )

{                FLIGHT F;

                  addInfo.F();

                 showInfo.F;

}

4) In the following program, find the correct possible output(s)from the options:

             #include<stdlib.h>

             #include<iostream.h>

             void main( )

            { randomize( );

            char City[ ][10]={“DEL”, “CHN”, “KOL”, “BOM”, “BNG”};

             int Fly;

            for(int I=0; I<3;I++)

             {Fly=random(2) + 1;

            cout<<City[Fly]<< “:”;

             }}

Outputs:

(i) DEL : CHN : KOL:                (ii) CHN: KOL : CHN:

(iii) KOL : BOM : BNG:            (iv) KOL : CHN : KOL:

5) In the following C++ program what is the expected value of Myscore from options (i) to (iv) given below. Justify your answer.

             #include<stdlib.h>

             #include<iostream.h>

             void main( )

            {        randomize( );

           int Score[ ] = {25,20,34,56,72,63},Myscore;

          cout<<Myscore<<endl;

            }I

          i) 25    (ii) 34    (iii) 20    (iv) Garbage Value.

Answer to Questions

1 Marks Answer

1) Ans:                 iostream.h

                              iomanip.h

2) Ans: iostream.h (ii) math.h,stdlib.h (iii) math.h (iv)fstream.h

2 marks Answers

1 Ans:

                      #include<iostream.h>

                     void test(int x,int y=20); //Prototype missing

                     void main( )

                    { int F = 10, S = 20; //Data type missing

                    Text(F,S); //Comma to come instead of ;

                   Text(S);


                     void Text(int x, int y)

                       { x=x+y;

cout<<x<<y; //Output operator << required }

2 Ans:Output:

[1]10&15

[2]21&13

[1]11&16

[2]22&14

3 Ans: #include<iostream.h>

class FLIGHT

{ long FlightCode;

char Description[25];

public:

void addInfo()

{ cin>>FlightCode; gets(Description);}

void showInfo()

{ cout<<FlightCode<<”:”<<Description<<endl;}

};

void main( )

{ FLIGHT F;

F.addInfo();

F.showInfo;

}

4 Ans)

Since random(2) gives either 0 or 1, Fly value will be either 1 or 2.

Read More