Page 1 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , HIGHER SECONDARY – FIRST YEAR, , XI - COMPUTER SCIENCE, Reduced syllabus, STUDY MATERIAL, 2021-2022, , NAME, STD & GROUP, , PREPARED BY, , J. ILAKKIA M.Sc., B.Ed., M.Phil., Computer Instructor Grade-I, , Govt. Hr. Sec. School, V.Pagandai, Villupuram 605 501., 1, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 2 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , TABLE OF CONTENTS, COMPUTER SCIENCE – I YEAR, CHAPTER NO, , CHAPTER TITLE, , UNIT I – FUNDAMENTALS OF COMPUTER AND WORKING WITH A TYPICAL, OPERATING SYSTEMS (WINDOWS), 1, , INTORDUCTION TO COMPUTERS, , 2, , NUMBERS SYSTEMS, , 3, , COMPUTER ORGANISATION, , 4, , THEORETICAL CONCEPTS OF OPERATING SYSTEM, , 5, , WORKING WITH WINDOWS OPERATING SYSTEM, , UNIT II – ALGORITHMIC PROBLEM SOLVING, 6, , SPECIFICATION AND ABSTRACTION, , 7, , COMPOSITION AND DECOMPOSITION, , 8, , ITERATION AND RECURSION, , UNIT III – INTRODUCTION TO C++, 9, , INTRODUCTION TO C++, , 10, , FLOW OF CONTROL, , 11, , FUNCTIONS, , 12, , ARRAYS AND STRUCTURES, , UNIT IV – OBJECT ORIENTED PROGRAMMING WITH C++, 13, , INTRODUCTION TO OBJECT ORIENTED PROGRAMMING, TECHNIQUES, , 14, , CLASSES AND OBJECTS, , 15, , POLYMORPHISM, , 16, , INHERITANCE, , UNIT V – COMPUTER ETHICS AND CYBER SECURITY, , 2, , 17, , COMPUTER ETHICS AND CYBER SECURITY, , 18, , TAMIL COMPUTING, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 3 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 1. INTRODUCTION TO COMPUTERS, , Choose the correct answer:, (1 mark), 1. First generation computers used, (a)Vacuum tubes, (b) Transistors, (c) Integrated circuits, (d) Microprocessors, 10. Which generation of computer used IC’s?, (a) First, (b) Second, (c) Third, (d) Fourth, Very Short Answers, (2 mark), 1. What is a computer?, • A computer is an electronic device that processes the input according to the set of instructions provided, to it and gives the desired output at a very fast rate., 2. Distinguish between data and information., Data, Information, Data is defined as an unprocessed collection, of raw facts, suitable for communication,, interpretation or processing., Example: 134, 16 ‘Kavitha’, ‘C’are data., , Information is a collection of facts from which, conclusions may be drawn., Example: Kavitha is 16 years old., , Short Answers, (2 mark), 1. What are the characteristics of a computer?, Computers have revolutionized our lives with their speed, accuracy, storage, reliability, versatility and, diligence performing a job, it is truly remarkable., 2. Write the applications of computer., Computers are seen everywhere around us, in all spheres of life, in the field of education, research, travel, and tourism, weather forecasting, social networking, e-commerce, Robotics , Nanotechnology,, Bioengineering etc., Explain in detail, (5 mark), 2. Discuss the various generations of computers., SN Generation, Period, Main Component, Merits/Demerits, used, • Big in size, 1, First, • Consumed more power, Generation 1940-1956, Vacuum tubes, • Malfunction due to overheat, • Machine Language was used, • Smaller compared to First Generation, • Generated Less Heat, • Consumed less power compared to first, generation, Second, • Punched cards were used, 2, Generation 1956-1964, Transistors, • First operating system was developed, Batch Processing and Multiprogramming, Operating System, • Machine language as well as Assembly, language was used., 3, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 4 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 3, , Third, Generation, , 4, , Fourth, Generation, , 5, , Fifth, Generation, , 6, , Sixth, Generation, , • Computers were smaller, faster and more, Integrated Circuits, reliable, 1964-1971, (IC), • Consumed less power, • High Level Languages were used, • Smaller and Faster, • Microcomputer series such as IBM and, 1971-1980, Microprocessor, APPLE were developed, • Portable Computers were introduced., • Parallel Processing, • Super conductors, • Computers size was drastically reduced., • Can recognise Images and Graphics, 1980 – till Ultra Large Scale • Introduction of Artificial Intelligence and, date, Integration (ULSI), Expert Systems, • Able to solve high complex problems, including decision making and logical, reasoning, • Parallel and Distributed computing, • Computers have become smarter, faster, and smaller, In future, • Development of robotics, • Natural Language Processing, • Development of Voice Recognition, Software, , 2. NUMBER SYSTEMS, , Choose the correct answer:, (1 mark), 1. Which refers to the number of bits processed by a computer’s CPU?, A) Byte, B) Nibble, C) Word length, 2. How many bytes does 1 Kilobyte contain?, A) 1000, B) 8, C) 4, 4. 2^50 is referred as, A) Kilo, B) Tera, C) Peta, 6. For 11012 what is the Hexadecimal equivalent?, A) F, B) E, C) D, 7. What is the 1’s complement of 00100110?, A) 00100110, B) 11011001, C) 11010001, 8. Which amongst this is not an Octal number?, A) 645, B) 234, C) 876, , 4, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , D) Bit, D) 1024, D) Zetta, D) B, D) 00101001, D) 123, , CS KNOWLEDGE OPENER
Page 5 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , Very Short Answers, (2 mark), 1. What is data?, The term data comes from the word datum, which means a raw fact. The data is a fact about people,, places or some objects., 2. Write the 1’s complement procedure., Step 1: Convert given Decimal number into Binary, Step 2: Check if the binary number contains 8 bits , if less add 0 at the left most bit, to make it as 8 bits., Step 3: Invert all bits (i.e. Change 1 as 0 and 0 as 1), 3. Convert (46)10 into Binary number, 2, 46, LSB, 2, 23, -0, 2, 11, -1, 2, 5, -1, 2, 2, -1, MSB 1, -0, (46)10 = (101110)2, 4. We cannot find 1’s complement for (28)10. State reason., Reason: We cannot find 1’s complement for (28)10. Because it is a positive number. 1’s complement, apply only with negative number., Short Answers, (3 mark), 1. What is radix of a number system? Give example, • Each number system is uniquely identified by its base value or radix., • Radix or base is the count of number of digits in each number system., • Radix or base is the general idea behind positional numbering system., • Radix or base is the general idea behind positional numbering system., Example:, Binary Number System, Radix 2, (1010)2, Octal Number System, Radix 8, (457)8, Decimal Number System, Radix 10, (312)10, Hexadecimal Number System, Radix 16, (25F)16, 2. Write note on binary number system., • There are only two digits in the Binary system, namely, 0 and 1., • The numbers in the binary system are represented to the base 2 and the positional multipliers are the, powers of 2., • The left most bit in the binary number is called as the Most Significant Bit (MSB)and it has the largest, positional weight., • The right most bit is the Least Significant Bit (LSB) and has the smallest positional weight., , 5, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 6 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 3. Convert (150)10 into Binary, then convert that Binary number to Octal, 2, 150, LSB, 2, 75, -0, 2, 37, -1, 2, 18, -1, 2, 9, -0, 2, 4, -1, 2, 2, -0, MSB 1, -0, (150)10 = (10010110)2, , Binary Number to Octal, , 10010110 = ?, 010, 010, 2, 2, (10010110)2 = (226)8, 5. Add a) -2210+1510, 2, 2, 2, 2, MSB, , 22, 11, 5, 2, 1, , Binary equivalent of +22 =, 8 bit format, =, 1’s complement, =, Add 1 bit, =, 2’s complement −22, =, , 2, 2, 2, MSB, , 6, , 15, 7, 3, 1, , 110, 6, , -0, -1, -1, -0, , LSB, , The Binary equivalent of, , 2210 = (10110)2, , 10110, 00010110, 11101001, +1, 11101010, , LSB, -1, -1, -1, , The Binary equivalent of 1510 = (111)2, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 7 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , The binary addition of −22 and 15, −2210 =, 11101010, +1510 =, 00001111, −710 =, 11111001, −710 = (11111001)2, , b) 2010+2510, , 2, 2, 2, 2, MSB, , 20, 10, 5, 2, 1, , - 0 LSB, -0, -1, -0, , The Binary equivalent of, , 2, 2, 2, 2, , 25, 12, 6, 3, 1, , LSB, -1, -0, -0, -1, , The Binary equivalent of 2510 = (11001), , =, =, =, , 00010100, 00011001, 00101101, , MSB, 8 bit format of 2010, 8 bit format of 2510, 4510, , 2010 = (10100)2, , 4510 = (00101101)2, , Explain in detail, (3 mark), 1. a) Write the procedure to convert fractional Decimal to Binary, The method of repeated multiplication by 2 has to be used to convert such kind of decimal fractions. The, steps involved in the method of repeated multiplication by 2:, Step 1: Multiply the decimal fraction by 2 and note the integer part. The integer part is either 0 or 1., Step 2: Discard the integer part of the previous product. Multiply the fractional part of the previous, product by 2. Repeat Step 1 until the same fraction repeats or terminates (0)., Step 3: The resulting integer part forms a sequence of 0s and 1s that become the binary equivalent of, decimal fraction., Step 4: The final answer is to be written from first integer part obtained till the last integer part obtained., , 7, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 8 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , b) Convert (98.46)10 to Binary, i) Integer Part, 2, 98, 2, 49, 2, 24, 2, 12, 2, 6, 2, 3, MSB 1, , LSB, -0, -1, -0, -0, -0, -1, , 9810 = (1100010)2, ii) Fraction Part, 0.46 × 2 = 0.92 = 0, 0.92 × 2 = 1.84 = 1, 0.84 × 2 = 1.68 = 1, 0.68 × 2 = 1.36 = 1, 0.36 × 2 = 0.72 = 0, 0.72 × 2 = 1.44 = 1, 0.44 × 2 = 0.88 = 0, 4610 = (0111010)2, (98.46)10 = (1100010. 0111010….)2, 2. Find 1’s Complement and 2’s Complement for the following Decimal number, a) -98, 2, 98, LSB, 2, 49, -0, 2, 24, -1, 2, 12, -0, 2, 6, -0, 2, 3, -0, MSB 1, -1, The Binary equivalent of 9810 = (1100010)2, Binary equivalent of +98 =, 8 bit format, =, 1’s complement, =, Add 1 bit, =, 2’s complement −98, =, −98 = (10011110)2, , 8, , 1100010, 01100010, 10011101, +1, 10011110, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 9 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , b) -135, , 2, 2, 2, 2, 2, 2, 2, MSB, , 135, 67, 33, 16, 8, 4, 2, 1, , LSB, -1, -1, -1, -0, -0, -0, -0, , The Binary equivalent of, , 13510 = (1000111)2, , Binary equivalent of +135 =, 10000111, 8 bit format, =, 10000111, 1’s complement, =, 01111000, Add 1 bit, =, +1, 2’s complement −135, =, 01111001, −135 = (01111001)2, , 3. COMPUTER ORGANISATION, , Choose the correct answer:, (1 mark), 1. Which of the following is said to be the brain of a computer?, (a) Input devices, (b) Output devices, (c) Memory device (d) Microprocessor, 2. Which of the following is not the part of a microprocessor unit?, (a) ALU, (b) Control unit, (c) Cache memory (d) register, 3. How many bits constitute a word?, (a) 8, (b) 16, (c) 32, (d) Determined by the processor used., 4. Which of the following device identifies the location when address is placed in the memory address, register?, (a) Locator, (b) Encoder, (c) Decoder, (d) Multiplexer, 5. Which of the following is a CISC processor?, (a) Intel P6, (b) AMD K6, (c) Pentium III, (d) Pentium IV, 6. Which is the fastest memory?, (a) Hard disk, (b) Main memory, (c) Cache memory (d) Blue-Ray disk, 7. How many memory locations are identified by a processor with 8 bits address bus at a time?, (a) 28, (b) 1024, (c) 256, (d) 8000, Very Short Answers, (2 mark), 1. What are the parameters which influence the characteristics of a microprocessor?, A Microprocessor’s performance depends on the following characteristics:, • Clock speed, • Instruction set, • Word size, 2. What is an instruction?, • A command which is given to a computer to perform an operation on data is called an instruction., 9, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 10 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 5. Which source is used to erase the content of a EPROM?, • Ultraviolet rays is used to erase the content of a EPROM., Short Answers, (3 mark), 1. Differentiate Computer Organization from Computer Architecture., Computer organization, Computer Architecture, Computer organization deals with the Computer Architecture also deals with how they, hardware components of a computer system are interconnected to implement an architectural, such as Input / Output devices, the CPU, specification., Storage Devices and Primary Memory., It deals with the hardware components that It deals with the engineering considerations, are transparent to the programmer., involved in designing a computer., 2. Classify the microprocessor based on the size of the data., • Depending on the data width, microprocessors can process instructions., • The microprocessors can be classified as follows:, • 8-bit microprocessor, • 16-bit microprocessor, • 32-bit microprocessor, • 64-bit microprocessor, 3. Write down the classifications of microprocessors based on the instruction set., • The size of the instruction set is important consideration while categorizing microprocessors., • Two types of Microprocessors based on their instruction sets:, Reduced Instruction Set Computers (RISC): Pentium IV, Intel P6, AMD K6 and K7., Complex Instruction Set Computers (CISC):, , Intel 386 & 486, Pentium, Pentium II and III, etc, , 4. Differentiate PROM and EPROM., PROM, , EPROM, , Programmable read only memory is a non- Erasable Programmable Read Only Memory is, volatile memory, a special type of memory., PROMs retain their contents even when the EPROM retains its contents until it is exposed, computer is turned off., to ultraviolet light., PROM can be written only once and, Ultraviolet rays is used to erase the content of a, cannot be erased., EPROM, 7. How will you differentiate a flash memory and an EEPROM?, Flash Memory, EEPROM, Flash memory is an electronic (solid-state) Electrically Erasable Programmable Read Only, non- volatile computer storage, Memory is a special type of PROM, Flash memory offers fast access times., EEPROM is slower in performance., It can be erased by exposing it to an It can be electrically erased and reprogrammed., electrical charge., , 10, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 11 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , Explain in detail, (3 mark), 1. Explain the characteristics of a microprocessor., A Microprocessor’s performance depends on the following characteristics:, • Clock speed, • Instruction set, • Word size, Clock speed, • Every microprocessor has an internal clock that regulates the speed at which it executes instructions., • The speed at which the microprocessor executes instructions is called the clock speed. Clock speed is, measured in MHz (Mega Hertz) or in GHz (Giga Hertz)., Instruction Set, • A command which is given to a computer to perform an operation on data is called an instruction., • Basic set of machine level instructions that a microprocessor is designed to execute is called as an, instruction set., • This instruction set carries out the following types of operations:, Data transfer, Arithmetic operations, Logical operations, Control flow, Input/output, Word Size, • The number of bits that can be processed by a processor in a single instruction is called its word size., • Word size determines the amount of RAM that can be accessed by a microprocessor, 3. Arrange the memory devices in ascending order based on the access time., Random-Access Memory (RAM), • The main memory or Random Access Memory is available in computers in the form of Integrated, Circuits (ICs)., • It is the place in a computer where the Operating System, Application Programs and the data in, current use are kept temporarily so that they can be accessed by the computer’s processor., • The smallest unit of information that can be stored as a bit., • The memory can be accessed as a byte., • RAM is a volatile memory., Cache Memory, • The cache memory is a very high speed and expensive memory used to speed up the memory retrieval, process., • Due to its higher cost, the CPU comes with a smaller size of cache memory compared with the size of, the main memory., • Without cache memory, every time the CPU requests the data, it has to be fetched from the main, memory which will consume more time., • The idea of introducing a cache is that, this extremely fast memory would store data that is frequently, accessed and if possible, the data that is closer to it., 11, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 12 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , • This helps to achieve the fast response time., • The arrangement of cache memory is between the CPU and the main memory., 4. Explain the types of ROM., Read Only Memory (ROM), • Read only memory refers to special memory in a computer with pre-recorded data at manufacturing, time which cannot be modified., • The stored programs that start the computer and perform diagnostics are available in ROMs., Programmable Read Only Memory (PROM), • Programmable read only memory is also a non-volatile memory on which data can be written only, once., • Once a program has been written onto a PROM, it remains there forever., • Unlike the main memory, PROMs retain their contents even when the computer is turned off., • The PROM differs from ROM. PROM is manufactured as a blank memory, whereas a ROM is, programmed during the manufacturing process itself., • PROM programmer or a PROM burner is used to write data to a PROM chip. The process of, programming a PROM is called burning the PROM., Erasable Programmable Read Only Memory (EPROM), • Erasable Programmable Read Only Memory is a special type of memory which serves as a PROM, but, the content can be erased using ultraviolet rays., • EPROM retains its contents until it is exposed to ultraviolet light., • The ultraviolet light clears its contents, making it possible to reprogram the memory., • An EPROM differs from a PROM, PROM can be written only once and cannot be erased., • EPROMs are used widely in personal computers because they enable the manufacturer to change the, contents of the PROM to replace with updated versions or erase the contents before the computer is, delivered., Electrically Erasable Programmable Read Only Memory (EEPROM), • Electrically Erasable Programmable Read Only Memory is a special type of PROM that can be erased, by exposing it to an electrical charge., • Like other types of PROM, EEPROM retains its contents even when the power is turned off., • Comparing with all other types of ROM, EEPROM is slower in performance., , 4. THEORETICAL CONCEPTS OF OPERATING SYSTEM, , Choose the correct answer:, (1 mark), 1. Operating system is a, a) Application Software b) Hardware, c) System Software, d) Component, 2. Identify the usage of Operating Systems, a) Easy interaction between the human and computer b) Controlling input & output Devices, c) Managing use of main memory, d) All the above, 4. Which of the following OS is a commercially licensed Operating system?, a) Windows, b) UBUNTU, c) FEDORA, d) REDHAT, 5. Which of the following Operating systems support Mobile Devices?, a)Windows 7, b)Linux, c) BOSS, d) iOS, 12, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 13 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 8. An example for single task operating system is, a) Linux, , b) Windows, , c) MS-DOS, , d) Unix, , Very Short Answers, (2 mark), 1. List out any two uses of Operating System?, • To ensure that a computer can be used to extract what the user wants it do., • Easy interaction between the users and computers., • Controlling Input and Output Devices, 2. What is the multi-user Operating system?, • Multi-user Operating system is used in computers and laptops that allow same data and applications, to be accessed by multiple users at the same time., • The users can also communicate with each other., Example: Windows, Linux and UNIX, 6. What are the different Operating Systems used in computer?, • Operating Systems used in personal computers and laptops are Windows, UNIX and Linux., • The different Operating Systems used in computers are:, Single User Operating Systems, Multi-user Operating Systems, Distributed Operating Systems, , 5. WORKING WITH WINDOWS OPERATING SYSTEM, , Choose the correct answer:, (1 mark), 1. From the options given below, choose the operations managed by the operating system., a. Memory, b. Processes, c. Disks and I/O devices d. All of the above, 2. Which is the default folder for many Windows Applications to save your file?, a. My Document b. My Pictures, c. Documents and Settings d. My Computer, 3. Under which of the following OS, the option Shift + Delete – permanently deletes a file or folder?, a. Windows 7, b. MS-DOS, c. Linux, d. Android OS, 5. The shortcut key used to rename a file in windows, a. F2, b.F4, c.F5, d. F6, Very Short Answers, (2 mark), 1. What is known as Multitasking?, • Multiple applications can execute simultaneously in Windows, and this is known as “Multitasking”., 2. What are called standard icons?, • Icons which are available on desktop by default while installing Windows OS are called Standard, Icons., • The standard icons available in all Windows OS are My Computer, 3. Differentiate Files and Folders., Files, Folders, A file consists of a collection of data., Each file has its own extension., 13, , A folder stores files and folders. It is also called a, directory., A folder does not have any extension, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 14 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , Folder and sub folder cannot be created in a file Folder and sub folder can be created in a folder, 4. Differentiate Save and Save As option., Save, , Save As, , “Save” command is used to save a document “Save As” command can save a file by two or, by only one name, more than two names., Shortcut Keys : Ctrl + S, Shortcut Keys : Ctrl+Shift+S, 5. How will you Rename a File?, • Rename files or folders can be done in number of ways such as using the File menu, left mouse button, or right mouse button., 1. Select the File, 2. Click File→ Rename., 3. Type in the new name., 4. To finalise the renaming operation, Short Answers, (3 mark), 1. What are the functions of Windows Operating system?, • Access applications on the computer., • Load any new program on the computer., • Manage hardware., • File management activities., • Change computer settings., 3. Write a note on the elements of a window., Title Bar, • The title bar will display the name of the application and the name of the document opened., Menu Bar, • Menus in the menu bar can be accessed by pressing Alt key and the letter that appears underlined in, the menu title., The Workspace, • The workspace area is used to enter or type the text of your document., Scroll bars, • The scroll bars are used to scroll the workspace horizontally or vertically., Corners and borders, • The corners and borders of the window helps to drag and resize the windows., 4. Write the two ways to create a new folder., Method I:, Step 1: Open Computer Icon., Step 2: Open any drive where you want to create a new folder., Step 3: Click on File → New → Folder., Step 4: A new folder is created with the default name “New folder”, Step 5: Type in the folder name and press Enter key., 14, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 15 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , Method II:, In order to create a folder in the desktop:, Step 1: In the Desktop, right click → New → Folder, Step 2: A Folder appears with the default name “New folder” and it will be highlighted., Step 3: Type the name you want and press Enter Key., Step 4: The name of the folder will change., 5. Differentiate copy and move., Copy, Move, Copy option is used to copy a file or folder,, Cut option is used to move a selected file or, and paste in a specified location., folder from one place to another., Edit → Copy or Ctrl + C or Right click→ Edit → Cut or Ctrl + X or Right click → Cut, Copy, Explain in Detail, 2. Explain the different ways of finding a file or Folder., To find a file or folder:, , (5 mark), , • Click the Start button, the search box appears at the bottom of the start menu., • Type the name of the file or the folder you want to search., • The files or the folders with the specified names will appear, if you click that file, it will directly open, that file or the folder., • Even if you give the part of the file or folder name, it will display the list of files or folders starting, with the specified name., • There is another option called “See more results” which appears above the search box., • If you click it, it will lead you to a Search Results dialog box where you can click and open that file, or the folder., Searching Files or folders using Computer icon, • Click Computer Icon from desktop or from Start menu., • The Computer disk drive screen will appear and at the top right corner of that screen, there is a search, box option., • Type the name of the file or the folder you want to search. Even if you give the part of the file or, folder name, it will display the list of files or folders starting with the specified name, • Just click and open that file or the folder., , 6. SPECIFICATION AND ABSTRACTION, , Choose the correct answer:, 1. Which of the following activities is algorithmic in nature?, (a) Assemble a bicycle., (c) Label the parts of a bicycle., , 15, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , (1 mark), , (b) Describe a bicycle., (d) Explain how a bicycle works., , CS KNOWLEDGE OPENER
Page 16 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 2. Which of the following activities is not algorithmic in nature?, (a) Multiply two numbers., (c) Walk in the park., , (b) Draw a kolam., (d) Swapping of two numbers., , 3. Omitting details inessential to the task and representing only the essential features of the task is known, as, (a) Specification, (b) abstraction, (c) composition, (d) decomposition, 4. Stating the input property and the input-output relation a problem is known, (a) Specification, (b) statement, (c) algorithm, 5. Ensuring the input-output relation is, (a) The responsibility of the algorithm and the right of the user., (b) The responsibility of the user and the right of the algorithm., (c) The responsibility of the algorithm but not the right of the user., (d) The responsibility of both the user and the algorithm., , (d) definition, , 6. If i = 5 before the assignment i := i-1 after the assignment, the value of i is, (b) 4, , (a) 5, , (c) 3, , (d) 2, , 7. If 0 < i before the assignment i := i-1 after the assignment, we can conclude that, (a) 0 < i, (b) 0 ≤ i, (c) i = 0, (d) 0 ≥i, Very Short Answers, (2 mark), 1. Define an algorithm., • An algorithm is a sequence of instructions to accomplish a task or solve a problem., 2. Distinguish between an algorithm and a process., ALGORITHM, , PROCESS, , • An algorithm is a sequence of • When the algorithms are executed, a process, instructions to accomplish a task or, evolves which accomplishes the intended, solve a problem., task or solves the given problem., 3. Initially,, farmer, goat, grass, wolf = L, L, L, L, and the farmer crosses the river with goat., Model the action with an assignment statement., SPECIFICATION:, 1. – – farmer, goat, grass, wolf = L, L, L, L, 2. farmer, goat := R, R, 3. – – farmer , goat , grass , wolf = R, R, L, L, 4. farmer := L, 5. – – farmer, goat, grass, wolf = L, R, L, L, 16, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 17 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 6. farmer, grass := R, R, 7. – – farmer , goat , grass , wolf = R, R, R, L, 8. farmer, goat := L, L, 9. – – farmer, goat, grass, wolf = L, L, R, L, 10. farmer, wolf := R, R, 11. – – farmer , goat , grass , wolf = R, L, R, R, 12. farmer : = L, 13. – – farmer , goat , grass , wolf = L, L, R, R, 14. farmer , goat : = R, R, 15. – – farmer , goat , grass , wolf = R, R, R, R, 4. Specify a function to find the minimum of two numbers., ANSWER:, Minimum (A,B), – – Inputs: A and B are integers (or) Real numbers, – – Outputs: A is minimum (A<B) (or) B is minimum (B<A), 5. If √2 = 1.414, and the square_root() function returns -1.414, does it violate the following, specification?, -- square_root (x), -- inputs: x is a real number , x ≥ 0, -- outputs: y is a real number such that y2=x, ANSWER:, No, because (- 1.414)2 = 2, which satisfies input – output relation (y2= x), Short Answers, 1. When do you say that a problem is algorithmic in nature?, , (3 mark), , • A problem is algorithmic in nature when its solution involves the construction of an algorithm., • Some types of problems can be immediately recognized as algorithmic using input and output data., 2. What is the format of the specification of an algorithm?, Specification format: We can write the specification in a standard three part format:, 1. The name of the algorithm and the inputs., algorithm_name (inputs), 2. Input: the property of the inputs., – – inputs : P, 3. Output: the desired input-output relation., – – outputs: Q, , 17, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 18 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 3. What is abstraction?, • Ignoring or hiding unnecessary details and modeling an entity only by its essential properties is known, as abstraction., Example:, • When we represent the state of a process, we select only the variables essential to the problem and, ignore inessential details., 4. How is state represented in algorithms?, • The state of a process can be represented by a set of variables in an algorithm., • The state at any point of execution is simply the values of the variables at that point., • As the values of the variables are changed, the state changes., 5. What is the form and meaning of assignment statement?, • Assignment statement is used to store a value in a variable., • It is written with the variable on the left side of the assignment operator and a value on the right side., • Assignment statement :, variable := value, Example:, m := 2, It stores value 2 in variable m., 6. What is the difference between assignment operator and equality operator?, ASSIGNMENT OPERATOR, Assignment Operator:, , :=, , EQUALITY OPERATOR, Equality Operator:, , =, , Assignment operator is used to assign the right Equality operator is used to compare the values of, hand side value into left hand side variable., both right hand side variable and left hand side, variable and results in either true or false., Example: u:=5, Example: u=v, Explain in Detail, (5 mark), 1. Write the specification of an algorithm hypotenuse whose inputs are the lengths of the two, shorter sides of a right angled triangle, and the output is the length of the third side., 1. hypotenuse (a, b), 2. – – inputs: a, b are real numbers, a > 0, b > 0, 3. – – outputs: c2 = a2 + b2 where c is real number, c > 0, 2. Suppose you want to solve the quadratic equation ax2 + bx + c = 0 by an algorithm., quadratic_solve (a, b, c), – – inputs : ?, – – outputs: ?, 18, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 19 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , You intend to use the formula and you are prepared to handle only real number roots. Write a, suitable Specification., −𝒃𝒃 ± √𝒃𝒃𝟐𝟐 − 𝟒𝟒𝟒𝟒𝟒𝟒, 𝑿𝑿 =, 𝟐𝟐𝟐𝟐, , ANSWER:, , SPECIFICATION:, Quadratic – solve (a, b, c), – – inputs: b2 – 4 ac > = 0 where a, b, c are real numbers, a ≠ 0, – – outputs: and x2 are real numbers such that a(x1)2 + bx1 + c = 0 and a(x2)2 + bx2 + c = 0, 3. Exchange the contents: Given two glasses marked A and B. Glass A is full of apple drink and, glass B is full of grape drink. For exchanging the contents of glasses A and B, represent the state by, suitable variables, and write the specification of the algorithm., ANSWER:, • Let the variables a, b, c represent the glass A, glass B and Glass C respectively., • Variables A, B, C can store values APPLE, GRAPE or EMPTY., Initial State:, 1. – –a, b, c := Apple, Grape, Empty, 2., , c, , :=b, , 3. – –a, b, c := Apple, Empty, Grape, 4., , b, , :=a, , 5. – –a, b, c := Empty, Apple, Grape, 6., Final State, , a, , :=c, , 7. – –a, b, c := Grape, Apple, Empty, , SPECIFICATION:, 1. Exchange ( ), 2. – – inputs: a, b, c := Apple, Grape, Empty, 3. – – outputs: a, b, c: = Grape, Apple, Empty, , 7. COMPOSITION AND DECOMPOSITION, , Choose the correct answer:, (1 mark), 1. Suppose u, v = 10 ,5 before the assignment. What are the values of u and v after the sequence of, assignments?, 1 u := v, 2 v := u, (a) u, v = 5 ,5, 19, , (b) u, v = 5 ,10, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , (c) u, v = 10 ,5, , (d) u, v = 10 ,10, CS KNOWLEDGE OPENER
Page 20 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 2. Which of the following properties is true after the assignment (at line 3?, 1 --i, j = 0, 0, 2 i, j := i+1, j-1, 3 -- ?, (a) i+j >0, , (c) i+j =0, , (b) i+j < 0, , (d) i = j, , 3. If C1 is false and C2 is true, the compound statement, 1 if C1, 2 S1, 3 else, 4, if C2, 5, S2, 6, else, 7, S3, executes, (a) S1, , (b) S2, , (c) S3, , (d) none, , 4. If C is false just before the loop, the control flows through, 1 S1, 2 while C, 3 S2, 4 S3, (a) S1 ; S3, (b) S1 ; S2 ; S3, (c)S1 ; S2 ; S2 ; S3, 5. If C is true, S1 is executed in both the flowcharts, but S2 is executed in, , (a) (1) only, (b) (2) only, 6. How many times the loop is iterated?, , (d) S1 ; S2 ; S2 ; S2 ; S3, , (c) both (1) and (2), , (d) neither (1) nor (2), , (c) 6, , (d) 0, , i := 0, while i ≠ 5, i := i + 1, (a) 4, , 20, , (b) 5, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 21 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , SECTION-B, , Very Short Answers, 1. Distinguish between a condition and a statement., CONDITION, , (2 mark), , STATEMENT, , • A condition is contained in a diamond-shaped • A statement is contained in a rectangular, box with two outgoing arrows, labeled true, box with a single outgoing arrow, which, and false., points to the box to be executed next., , 2. Draw a flowchart for conditional statement., , 3. Both conditional statement and iterative statement have a condition and a statement. How do, they differ?, CONDITION STATEMENT, • Conditional statement is executed only if the, condition is true. Otherwise, nothing is done., • If, If Else are the examples of Conditional, Statements, , 21, , ITERATIVE STATEMENT, • Iterative statement repeatedly evaluates a, condition and executes a statement as long, as the condition is true., • While, Do While are the examples of, Iterative Statements, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 22 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 4. What is the difference between an algorithm and a program?, ALGORITHM, • An algorithm is a sequence of instructions to, accomplish a task or solve a problem., , PROGRAM, • An algorithm expressed in a programming, language is called a program., , 5. Why is function an abstraction?, • After an algorithmic problem is decomposed into sub problems, we can abstract the sub problems as, functions., • A function can also be specified by its input property, and its input-output relation., 6. How do we refine a statement?, • Each sub problem can be expanded into more detailed steps., • Each step can be further expanded to still finer steps, and so on., • This is known as refinement., Short Answers, 1. For the given two flowcharts write the pseudo code., , (3 mark), , PSEUDO CODE:, 1. Start, 2. Input A,B, 3. If A>B then Prints “S1” and “S2”, 4. End, , PSEUDO CODE:, 1. Start, 2. Input A,B, 3. If A>B then Prints “S1”, 4. Else print “S2”, 5. End, 22, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 23 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 2. If C is false in line 2, trace the control flow in this algorithm., 1. S1, 2. -- C is false, 3. if C, 4. S2, 5. else, 6. S3, 7. S4, , ANSWER: S1; S3; S4, 3. What is case analysis?, • Case analysis statement generalizes it to multiple cases., • Case analysis splits the problem into an exhaustive set of disjoint cases., • For each case, the problem is solved independently., EXAMPLE:, 1. case C1, 2. S1, 3. case C2, 4. S2, 5. else, 6. S3, 4. Draw a flowchart for -3case analysis using alternative statements., , 23, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 24 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 5. Define a function to double a number in two different ways: (1) n + n,, (1) n + n, Double(n), - - Input: n is a real number or an integer, n>0, - - Output: y is a real number or an integer such that y = n + n, (2) 2 x n, Double(n), - - Input: n is a real number or an integer, n>0, - - Output: y is a real number or an integer such that y = 2 ×n, , (2) 2 × n, , Example: Double a Value can be done in 2 Methods, n=2 (assume), 1. n+n= 2+2= 4, 2. 2×n=2×2= 4, Explain in Detail, (5 mark), 1. Exchange the contents: Given two glasses marked A and B. Glass A is full of apple drink and, glass B is full of grape drink. Write the specification for exchanging the contents of glasses A and, B, and write a sequence of assignments to satisfy the specification., ANSWER:, Let the variables a, b, c represent Glass A, Glass B and Glass C and a, b, c can store values APPLE,, GRAPE or EMPTY., SPECIFICATION:, 1. Exchange (a, b), 2. – – inputs: a, b : = APPLE, GRAPE, 3. – – outputs: a, b : = GRAPE, APPLE, ALGORITHM:, Initial State:, , 1. – –a, b, c := Apple, Grape, Empty, 2., , c, , :=b, , 3. – –a, b, c := Apple, Empty, Grape, 4., , b, , :=a, , 5. – –a, b, c := Empty, Apple, Grape, 6., Final State, , 24, , a, , :=c, , 7. – –a, b, c := Grape, Apple, Empty, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 25 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 2. Circulate the contents: Write the specification and construct an algorithm to circulate the, contents of the variables A, B and C as shown below: The arrows indicate that B gets the value of A,, C gets the value of B and A gets the value of C., , SPECIFICATIONS:, 1. circulate, 2. – – inputs: a, b, c: = A, B, C, 3. – – outputs: a, b, c: = C, A, B, ALGORITHM:, 1. circulate (a, b, c), 2. – – a, b, c: = A, B, C, 3. temp : = c, 4. c : = b, 5. b : = a, 6. a : = temp, 7. – – a, b, c: = C, A, B, 3. Decanting problem. You are given three bottles of capacities 5 ,8, and 3 litres. The 8L bottle is, filled with oil, while the other two are empty. Divide the oil in 8L bottle into two equal quantities., Represent the state of the process by appropriate variables. What are the initial and final states, of the process? Model the decanting of oil from one bottle to another by assignment. Write a, sequence of assignments to achieve the final state., (a) MODEL:, Let a, b, c be the variables whose maximum values are 8L, 5L and 3L respectively., Initial State: a, b, c := 8, 0, 0, Bottel 1 = 8 L, a, , 25, , Bottel 2 = 5 L, b, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , Bottel 3 = 3 L, c, , CS KNOWLEDGE OPENER
Page 26 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , Final State: a, b, c := 4, 4, 0, Bottel 1 = 8 L, a, , Bottel 2 = 5 L, b, , Bottel 3 = 3 L, c, , (b) SPECIFICATION:, decant, – – inputs: a, b, c : = 8, 0, 0, – – outputs: a, b, c : = 4, 4, 0, (c) ALGORITHM:, Let us assume that a: = b denotes oil in b is poured into a bottle until either “a” is full or “b” becomes, empty., decant (a, b, c), – – a, b, c : = 8, 0, 0, b:=a, – – a, b, c : = 3, 5, 0, c:=b, – – a, b, c : = 3, 2, 3, a:=c, – – a, b, c : = 6, 2, 0, c:=b, – – a, b, c : = 6, 0, 2, b:=a, – – a, b, c : = 1, 5, 2, c:=b, – – a, b, c : = 1, 4, 3, a:=c, – – a, b, c: = 4, 4, 0, , 26, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 27 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 4. Trace the step-by-step execution of the algorithm for factorial(4)., factorial(n), -- inputs : n is an integer , n ≥ 0, -- outputs : f = n!, f, i := 1 ,1, while i ≤ n, f, i := f × i, i+1, ALGORITHM TRACE:, f =1, i =1, , f=f*i, , i = i +1, , 1st iteration, , f=1x1=1, , i=1+1=2, , 2nd iteration, , f=1x2=2, , i=2+1=3, , 3rd iteration, , f=2x3=6, , i=3+1=4, , 4th iteration, , f = 6 x 4 = 24, , i=4+1=5, LOOP TERMINATES, , 8. ITREATION AND RECURSION, Choose the correct answer:, 1. A loop invariant need not be true, (a) at the start of the loop., (c) at the end of each iteration, , (1 mark), (b) at the start of each iteration, (d) at the start of the algorithm, , 2. We wish to cover a chessboard with dominoes,, the number of black squares and the number of, white squares covered by dominoes, respectively, placing a domino can be modeled by, (a) b := b + 2, (b) w := w + 2, (c) b, w := b+1, w+1, (d) b := w, 3. If m x a + n x b is an invariant for the assignment a, b : = a + 8, b + 7, the values of m and n are, (a) m = 8, n = 7, (b) m = 7, n = -8 (c) m = 7, n = 8, (d) m = 8, n = -7, 4. Which of the following is not an invariant of the assignment?, m, n := m+2, n+3, (a) m mod 2, (b) n mod 3, (c) 3 X m - 2 X n, , 27, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , (d) 2 X m - 3 X n, , CS KNOWLEDGE OPENER
Page 28 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , Very Short Answers, 1. What is an invariant?, , (2 mark), , • An expression involving variables, which remains unchanged by an assignment to one of these, variables, is called an invariant of the assignment., 2. Define a loop invariant., • An invariant for the loop body is known as a loop invariant., • An unchanging property of the variables during loop execution is also called the loop invariant., 3. Does testing the loop condition affect the loop invariant? Why?, • No, the loop conditions do not affect the loop invariant., • Because each time the loop body is executed repeatedly, the variables are updated. However, there is, also a property of the variables which remains unchanged by the execution of the loop body., • This unchanging property is called the loop invariant., 4. What is the relationship between loop invariant, loop condition and the input- output, recursively?, • A loop invariant is a condition (among program variables) that is necessarily true immediately before, and immediately after, each iteration of a loop., • A loop invariant has some conditions that hold for every iteration of the loop., Short Answers, (3 mark), 1. There are 7 tumblers on a table, all standing upside down. You are allowed to turn any 2, tumblers simultaneously in one move. Is it possible to reach a situation when all the tumblers, are right side up? (Hint: The parity of the number of upside down tumblers is invariant.), ANSWER:, Let’s assume,, u – No. of tumblers right side up, v – No. of tumblers upside down, INITIAL STAGE :, u = 0, v = 7 (All tumblers upside down), FINAL STAGE OUTPUT:, u = 7, v = 0 (All tumblers right side up), POSSIBLE ITERATIONS:, (i) Turning both upside down tumblers to right side up, u = u + 2, v = v – 2 [u is even], (ii) Turning both right side up tumblers to upside down., u = u – 2, v = v + 2 [u is even], (iii) Turning one right side up tumblers to upside down and other tumbler from upside down to right side, up., u = u + 1 – 1 = u, v = v + 1 – 1 = v [u is even], • Initially u = 0 and continuous to be even in all the three cases., • Therefore u is always even., • INVARIANT: u is even (i. e. No. of right side up tumblers are always even), • But in the final stage (Goal), u = 7 and v = 0 i. e. u is odd., 28, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 29 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , • Therefore it is not possible to reach a situation where all the tumblers are right side up., Explain in Detail, (5 mark), 1. Assume an 8 × 8 chessboard with the usual coloring. "Recoloring" operation changes the color of, all squares of a row or a column. You can recolor re-peatedly. The goal is to attain just one black, square. Show that you cannot achieve the goal. (Hint: If a row or column has b black squares, it, changes by (|8 - b) - b|)., ANSWER:, In a chess board no. of squares in any row or column = 8, Total No. of squares = 8 x 8 = 64, No. of black squares = 32, No. of white squares = 32, Let No. of blacks in a selected recoloring row or column = b, No. of black squares after recoloring operation = 8 – b, Initial state b = 32, Desired final state b = 1, Let us tabulate all the possible outcomes after recoloring a row or column., No. of Black Squares, No. of Black Squares, Difference, Difference, in a row or column, in a row or column, = |b – (8−b)|, (even or odd), before recoloring (b) before recoloring (−b), 1, 7, 6, even, 2, 6, 4, even, 3, 5, 2, even, 4, 4, 0, Zero (even), 5, 3, 2, even, 6, 2, 4, even, 7, 1, 6, even, Difference is the no. of black squares left out in a row or column after recoloring operation. Difference is, even. Difference is invariant., But our goal is one ( 1 is odd) black square, so, it is not possible to attain the goal., , 9. INTRODUCTION TO C++, , Choose the correct answer, (1 mark), 1. Who developed C++?, (a) Charles Babbage, (b) Bjarne Stroustrup (c) Bill Gates, (d) Sundar Pichai, 2. What was the original name given to C++?, (a) CPP, (b) Advanced C, (c) C with Classes, (d) Class with C, 3. Who coined C++?, (a) Rick Mascitti, (b) Rick Bjarne, (c) Bill Gates, (d) Dennis Ritchie, 4. The smallest individual unit in a program is:, (a) Program, (b) Algorithm, (c) Flowchart, (d) Tokens, 29, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 30 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 5. Which of the following operator is extraction operator in C++?, (a) >>, (b) <<, (c) <>, (d) ^^, 6. Which of the following statements is not true?, (a) Keywords are the reserved words which convey specific meaning to the C++ compiler., (b) Reserved words or keywords can be used as an identifier name., (c) An integer constant must have at least one digit without a decimal point., (d) Exponent form of real constants consist of two parts, 7. Which of the following is a valid string literal?, (a) ‘A’, (b) ‘Welcome’, (c) 1232, (d) “1232”, 8. A program written in high level language is called as, (a) Object code, (b) Source code, (c) Executable code, (d) All the above, 9. Assume a=5, b=6; what will be result of a&b?, (a) 4, (b) 5, (c) 1, (d) 0, 10. Which of the following is called as compile time operators?, (a) sizeof, (b) pointer, (c) virtual, (d) this, Very Short Answers, (2 mark), 1. What is meant by a token? Name the token available in C++., • The smallest individual unit in a program is known as a Token or a Lexical unit, • C++ has the following tokens:, Keyword, Identifiers, Literals, Operators, Punctuators, 2. What are keywords? Can keywords be used as identifiers?, • Keywords are the reserved words which convey specific meaning to the C++ compiler., • Reserved words or keywords cannot be used as an identifier name., 3. The following constants are of which type?, (i) 39, (ii) 032, (iii) 0XCAFE, (iv) 04.14, i) 39, –, Integer, ii) 032, –, Octal, iii) OXCAFE –, Hexadecimal, iv) 04.14, –, Floating Point, 4. Write the following real constants into the exponent form:, (i) 23.197, (ii) 7.214, (iii) 0.00005, (iv) 0.319, 2, i) 23.197, = 0.23197 x 10, => 0.23197E02, 1, ii) 7.214, = 0.7214 x 10, => 0.7214E01, -4, iii) 0.00005 = 0.5 x 10, => 0.5E – 04, -1, iv) 0.319, = 3.19 x 10, => 0.0319E-01, , 30, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 31 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 5. Assume n=10; what will be result of n++ and --n?, Result:, n++ n=10+111, --n n-1=10-1 9, 6. Match the following, A, B, a) Modulus, , 1) Tokens, , b) Separators, , 2) Remainder of a division, , c) Stream extraction, , 3) Punctuators, , d) Lexical Units, Answer: a-2; b-3; c-4, d-1, A, , 4) get from, B, , a) Modulus, , 2) Remainder of a division, , b) Separators, , 3) Punctuators, , c) Stream extraction, , 4) get from, , d) Lexical Units, , 1) Tokens, , Short Answers, 1. Describe the differences between keywords and identifiers?, Keywords, , (3 mark), Identifiers, , • Keywords are the reserved words which, convey specific meaning to the C++, compiler., • They are the essential elements to construct, C++ programs., , • Identifiers are the user-defined names given, to the variables, functions, arrays, classes, etc., • These are the fundamental building blocks, of a program., , • Example: Switch, for, if, etc.,, , • Example: name, age, class, etc.,, , 2. Is C++ case sensitive? What is meant by the term “case sensitive”?, • Yes, C++ is case sensitive as it treats upper and lower-case characters differently., • All the keywords must be in lowercase, 3. Differentiate “=” and “==”., “=”, • ‘=’ is an assignment operator, • It is used to assign the value of variable or, expression, • Example: x=y (y value is assigned to x), , 31, , “= =”, • ‘= =’ is an equal to operator and it is a, relational operator., • It is used for compare two values and the, result will be either true or false, • Example: x==y (x value will be compared, with y value), , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 32 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 4. What is the use of a header file?, • #include<iostream> statement tells the compiler’s preprocessor to include the header file, “iostream” in the program., • The header file “iostream” should be included to implement input/output functionalities., • In simple words, “iostream” header file contains the definition of its member objects cin and, cout., 5. Why is main function special?, • The main( ) function in the C++ program is the starting point., • All the programs begin their execution in main()., • Therefore, the executable statements should be inside the main( ) function., Explain in Detail, (5 mark), 1. Write about Binary operators used in C++., Binary Operators - Require two operands and one operator, , C++ Binary Operators are classified as:, (1) Arithmetic Operators, (2) Relational Operators, (3) Logical Operators, (4) Assignment Operators, (5) Conditional Operator, , (1) Arithmetic Operators, , • Arithmetic operators perform simple arithmetic, multiplication, division etc.,, • Support both unary and binary operations., Operator, Operation, +, Addition, Subtraction, *, Multiplication, /, Division, %, Modulus (To find the reminder of a division), , (2) Relational Operators, , operations, , like addition,, , subtraction,, , Example, , 10 + 5 = 15, 10 – 5 = 5, 10 * 5 = 50, 10 / 5 = 2 (Quotient), 10 % 3 = 1(Remainder), , • Relational operators are used to determine the relationship between its operands., • When the relational operators are applied on two operands, the result will be a Boolean value (True, /1 ) or (False/0)., Operator, Operation, Example, a=5, b=6, >, Greater than, a > b = False, <, Less than, a < b = True, >=, Greater than or equal to, a >= b = False, <=, Less than or equal to, a <= b = True, ==, Equal to, a == b = False, !=, Not equal, a != b = True, 32, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 33 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , (3)Logical Operators, • A logical operator is used to evaluate logical by combining two relational expressions into one., • The logical operators act upon the operands that are themselves called as logical expressions., • AND, OR both are binary operators and NOT is a unary operator., Operator, Operation, Description, • It returns 1 (True), if both expression are true, otherwise it returns 0, &&, AND, (false)., • It returns 1 (True), if either one of the expression is true. It returns 0, ||, OR, (false), if both the expressions are false., • NOT works on a single operand., !, NOT, • It simply negates or inverts the value. i.e., if it is 1 (true) then returns, 0 (false) and vice versa, , (4)Assignment Operator:, , • = (equal to) is the Assignment operator is used to assign a value on the right handside to a variable, which is on the left hand side ., • It is also a binary operator., Operator, Name of Operator, Example, a = 10;, +=, Addition Assignment, c = a += 5;(ie, a = a + 5), c = 15, a = 10;, -=, Subtraction Assignment, c = a -= 5;(ie. a = a – 5), c=5, a = 10;, *=, Multiplication Assignment, c = a *= 5;(ie. a = a * 5), c = 50, a = 10;, /=, Division Assignment, c = a /= 5;(ie. a = a / 5), c=2, a = 10;, %=, Modulus Assignment, c = a %= 5; (ie. a = a % 5), c=0, , (5) Conditional Operator:, , • ?: is a conditional Operator which is also known as Ternary Operator., • This operator is used as an alternate to if … else control statement., 2. What are the types of Errors?, Type of Error, Description, • Syntax is a set of grammatical rules to construct a program., • Syntax errors occur when grammatical rules of C++ are violated., • Example: if you type as follows, C++ will throw an error., Syntax Error, cout << “Welcome to Programming in C++”, 33, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 34 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , • As per grammatical rules of C++, every executable statement should terminate, with a semicolon. But, this statement does not end with a semicolon., • A Program has not produced expected result even though the program is, grammatically correct., Semantic Error • It may be happened by wrong use of variable / operator / order of execution etc., • This means, program is grammatically correct, but it contains some logical error., So, Semantic error is also called as “Logical Error”., • A run time error occurs during the execution of a program., Run-time error • It occurs because of some illegal operation that takes place., • Example: If a program tries to open a file which does not exist, it results in a, run-time error, , DATA TYPES, VARIABLES AND EXPRESSIONS, , Choose the correct answer, (1 Mark), 1. How many categories of data types are available in C++?, (a) 5, (b) 4, (c) 3, (d) 2, 2. Which of the following data types is not a fundamental type?, (a) signed, (b) int, (c) float, (d) char, 3. What will be the result of following statement?, char ch= ‘B’;, cout << (int) ch;, (a) B, (b) b, (c) 65, (d) 66, 4. Which of the character is used as suffix to indicate a floating point value?, (a) F, (b) C, (c) L, (d) D, 5. How many bytes of memory is allocated for the following variable declaration if you are using, Dev C++? short int x;, (a) 2, (b) 4, (c) 6, (d) 8, 6. What is the output of the following snippet?, char ch = ‘A’;, ch = ch + 1;, (a) B, (b) A1, (c) F, (d) 1A, 7. Which of the following is not a data type modifier?, (a) signed, (b) int, (c) long, (d) short, 8. Which of the following operator returns the size of the data type?, (a) sizeof( ), (b) int ( ), (c) long ( ), (d) double ( ), 9. Which operator is used to access reference of a variable?, (a) $, (b) #, (c) &, (d) !, Very Short Answers, (2 Mark), 1. Write a short note on const keyword with an example., • const is the keyword used to declare a constant., • const keyword modifies / restricts the accessibility of a variable., • It is known as Access modifier., 34, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 35 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , For example,, int num = 100;, 3. Why is char often treated as integer data type?, • Character data type accepts and returns all valid ASCII characters., • Character data type is often said to be an integer type, since all the characters are represented in, memory by their associated ASCII Codes., • If a variable is declared as char, C++ allows storing either a character or an integer value., 4. What is a reference variable? What is its use?, • A reference provides an alias for a previously defined variable., • Declaration of a reference consists of base type and an & (ampersand) symbol; reference variable, name is assigned the value of a previously declared variable., Syntax:, <type> <& reference_variable> = <original_variable>;, 5. Consider the following C++ statement. Are they equivalent?, char ch = 67; char ch = ‘C’;, Yes, they are equal, • Both the statements are equivalent as they declare ‘ch’ to be char and initialize it with the value of, 67., • Since this is the ASCII code for ‘C’, the character constant also can be used to initialize ‘ch’ to 67., 6. What is the difference between 56L and 56?, 56L, 56, • The suffix L forces the constant to be, • This will be represented as int type, represented as long, which occupies 4, constant which occupies 2 bytes as per, bytes., Turbo C++., 7. Determine which of the following are valid constant? And specify their type., (i) 0.5, (ii) ‘Name’, (iii) ‘\t’ (iv) 27,822, i) 0.5, – is a valid Floating constant., ii) ‘Name’ – Invalid constant as single quote is not allowed., iii) ‘\t’, – Escape sequence (or) non – graphical character (horizontal tab)., iv) 27,822 – Invalid constant. Comma is not allowed., 8. Suppose x and y are two double type variable that you want add as integer and assign to an, integer variable. Construct a C++ statement to do the above., Answer:, double x=11.5; y=3.5;int a;, a = int (x) + int (y);, 9. What will be the result of following if num=6 initially., (a) cout << num;, (b) cout << (num==5);, Answer:, (a) 6, (b) False, 35, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 36 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 10. Which of the following two statements are valid? Why? Also write their result., (i) int a; a = 3,014;, (ii) int a; a=(3,014);, Answer:, i) It is invalid as comma is not allowed in an integer constant., ii) It is valid. Comma in bracket is allowed., Short Answers, (3 Mark), 1. What are arithmetic operators in C++? Differentiate unary and binary arithmetic operators., Give example for each of them., • Arithmetic operators perform simple arithmetic operations like addition, subtraction,, multiplication, division etc.,, • The above mentioned arithmetic operators are binary operators which requires minimum of two, operands., Unary Operators, Binary Operators, • Require only one operand, • Require two operands, • Ex: +, -, *, /, %, >, <, <=, AND, OR, • Ex: ++ (Plus, Plus) Increment operator, – –, (Minus, Minus) Decrement operator, NOT, ~,, 2. How relational operators and logical operators are related to one another?, • Relational operators are used to determine the relationship between its operands., • When the relational operators are applied on two operands, the result will be a Boolean value 1 or, 0 which represents True or False respectively which represents logical operator., 3. Evaluate the following C++ expressions where x, y, z are integers and m, n are floating point, Numbers. The value of x = 5, y = 4 and m=2.5;, (i) n = x + y / x;, (ii) z = m * x + y;, (iii) z *= x * m + x;, 1. n = x + y / x;, = 5 + 4/5, = 5 + 0 (both x and y are int type. Therefore only integer part of quotient is considered), =5, 2. z = m * x + y;, = 2.5 * 5 + 4 (m is float type, so x value is promoted to float [implicit conversion]), = 12.5 + 4 ‘, = 16 (2 is int type. So ‘.2’, the fractional part is discarded), 3. z = (x++) * m + x;, = 5*2.5 + x, = 12.5 + 5, = 18 (z is int type, therefore the fractional part is removed, x is incremented after the addition), , 10. FLOW OF CONTROL, , Choose the correct answer, (1 Mark), 1. What is the alternate name of null statement?, (A) No statement, (B) Empty statement (C) Void statement, (D) Zero statement, 36, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 37 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 2. In C++, the group of statements should be enclosed within:, (A) { }, (B) [ ], (C) ( ), (D) < >, 3. The set of statements that are executed again and again in iteration is called as:, (A) condition, (B) loop, (C) statement, (D) body of loop, 4. The multi way branch statement:, (A) if, (B) if … else, (C) switch, (D) for, 5. How many types of iteration statements?, (A) 2, (B) 3, (C) 4, (D) 5, 6. How many times the following loop will execute? for (int i=0; i<10; i++), (A) 0, (B) 10, (C) 9, (D) 11, 7. Which of the following is the exit control loop?, (A) for, (B) while, (C) do…while, (D) if…else, 8. Identify the odd one from the keywords of jump statements:, (A) break, (B) switch, (C) goto, (D) continue, 9. Which of the following is called entry control loop?, (A) do-while, (B) for, (C) while, (D) if-else, 10. A loop that contains another loop inside its body:, (A) Nested loop, (B) Inner loop, (C) Inline loop, (D) Nesting of loop, Very Short Answers, (2 Mark), 1. What is a null statement and compound statement?, Null Statement, • The "null or empty statement" is a statement containing only a semicolon which is used as, placeholders in iteration statements or as statements on which to place labels at the end of compound, statements or functions., ;, // it is a null statement, Compound Statement:, • The group of statements enclosed by pair of braces {} is called as a compound statement or a block., General Format:, {, statement1;, statement2;, statement3;, }, 2. What is selection statement? write it's types?, • Selection statements are executed depending upon the conditional expression evaluates either true or, false., Types:, • if statement, • if-else statement, • Nested if, • if -else-if ladder, • Alternative to if- else (?:), 37, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 38 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , • Switch statement, 3. Correct the following code segment : if (x=1), p= 100;, else, p = 10;, Corrected Coding:, if (x==1) Relational operator should be used instead of assignment operator, p= 100;, else, p = 10;, 4. What will be the output of the following code:, int year;, cin >> year;, if (year % 100 == 0), if ( year % 400 == 0), cout << "Leap";, else, cout << "Not Leap year";, If the input given is (i) 2000 (ii) 2003 (iii) 2010?, Output:, i) Leap year, ii) Not Leap year, iii) Not Leap year, 5. What is the output of the following code?, for (int i=2; i<=10 ; i+=2), cout << i;, Output:, 2 4 6 8 10, 6. Write a for loop that displays the number from 21 to 30., #include<iostream>, using namespace std;, int main(), {, int i;, for (i=21; i<=30 ; i++), cout << i;, return 0;, }, 7. Write a while loop that displays numbers 2, 4, 6, 8.......20., Coding:, #include<iostream>, using namespace std;, 38, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 39 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , int main(), {, int i=2;, while(i<=20), {, cout<<i<< "\t";, i+=2;, }, return 0;, }, 8. Compare an if and a ? : operator., if, ?:, • The if statement evaluates a condition, if • In the conditional operator or Ternary operator, the condition is true then a true-block, (?:) the expression 1 is a condition which is, statements will be executed, otherwise the, evaluated, if the condition is true (Non-zero),, then the control is transferred to expression 2,, true-block is skipped, otherwise, the control passes to expression 3., Syntax:, Syntax:, if (expression), true-block;, expression 1? expression 2 : expression 3, statement-x;, Short Answers, 1. Convert the following if-else to a single conditional statement:, if (x >= 10), a = m + 5;, else, a = m;, Answer:, a=(x>=10) ? m+5: m;, 2. Rewrite the following code so that it is functional:, v = 5;, do;, {, total += v;, cout << total;, while v <= 10, , (3 Mark), , Answer:, int v=5;, do, {, 39, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 40 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , total+=v;, cout<<total;, v=v+1;, } while (v<=10);, 3. Write a C++ program to print multiplication table of a given number., Coding:, #include<iostream>, using namespace std;, int main(), {, int num;, cout<< “Enter Number to find multiplication table”;, cin>>num;, for(int a=1; a<=10; a++), {, cout<<num<< “*”<<a<< “=”<<num*a<<endl;, }, return 0;, }, 4. Write the syntax and purpose of switch statement., Syntax:, switch(expression), {, case constant 1:, statement(s);, break;, case constant 2:, statement(s);, break;, ., ., default:, statement(s);, }, Purpose:, • The switch statement is a multi-way branch statement which provides an easy way to dispatch, execution to different parts of code based on the value of the expression., • It replaces multiple if-else sequence., 5. Write a short program to print following series:, (a) 1 4 7 10...... 40, #include<iostream>, using namespace std;, 40, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 41 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , int main(), {, int i;, for(int i=1; i<=40; i+=3), {, cout<<i<<"\t";, }, return 0;, }, Explain in detail, (5 Mark), 2. What is an entry control loop? Explain any one of the entry controlled loop with suitable, example., Entry Controlled Loop:, • The for loop is an entry- controlled loop., • It is the easiest looping statement which allows code to be executed repeatedly., • It contains three different statements (initialization, condition or test-expression and update, expression(s)) separated by semicolons., Syntax:, for (initialization(s); test-expression; update expression(s)), {, Statement 1;, Statement 2;, …………., }, Statement-x;, Working of for loop:, • The initialization part is used to initialize variables or declare variable which are executed only once,, then the control passes to test-expression., • After evaluation of test-expression, if the result is false, the control transferred to statement-x., • If the result is true, the body of the for loop is executed, next the control is transferred to update, expression., • After evaluation of update expression part, the control is transferred to the test-expression part., • Next the steps 3 to 5 is repeated. The workflow of for loop and flow chart are shown below., Flowchart:, , 41, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 43 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 30, GCD=10 LCM=60, 4. Write programs to find the sum of the following series:, #include<iostream>, #include<conio.h>, #include<math.h>, using namespace std;, int fact(int n), {, int f=1;, for(int i=1;i<=n;i++), f*=i;, return f;, }, int main(), {, int x,s=1;, float sum=0;, cout<<"Enter the value for x:";, cin>>x;, for(int i=1;i<=6;i++), {, sum=sum+s*(pow(x,i)/fact(i));, s*=-1;, }, cout<<"Sum of series is "<<sum<<endl;, getch();, return 0;, }, #include<iostream>, #include<conio.h>, #include<math.h>, using namespace std;, int main(), {, int x,n;, float sum=0;, cout<<"Enter the value for x:";, cin>>x;, 43, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 44 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , cout<<"Enter number of terms:";, cin>>n;, for(int i=1;i<=n;i++), sum=sum+pow(x,i)/i;, cout<<"Sum of series is "<<sum<<endl;, getch();, return 0;, }, 5. Write a program to find sum of the series, S = 1 + x + x2 +..... + xn, #include<iostream>, #include<conio.h>, #include<math.h>, using namespace std;, int main(), {, int x,n;, float sum=0;, cout<<"Enter the value for x";, cin>>x;, cout<<"Enter number of terms";, cin>>n;, for(int i=1;i<=n;i++), sum=sum+pow(x,i);, cout<<"Sum of series is "<<sum<<endl;, getch();, return 0;, }, , 11. FUNCTIONS, , Choose the correct answer, (1 Mark), 3. Which function begins the program execution ?, A) isalpha(), B) isdigit(), C) main(), D) islower(), 4. Which of the following function is with a return value and without any argument ?, A) x=display(int, int), B) x=display(), C) y=display(float), D) display(int), 5. Which is return data type of the function prototype of add(int, int); ?, A) int, B) float, C) char, D) double, 6. Which of the following is the scope operator ?, A) >, B) &, C) %, D) ::, Very Short Answers, (2 Mark), 1. Define Functions., • A large program can be split into small sub-programs (blocks) called as functions where each subprogram can perform some specific functionality., 44, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 45 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 3. What are importance of void data type., • To indicate the function does not return a value, • To declare a generic pointer., 4. What is Parameter and list its types?, • Arguments or parameters are the means to pass values from the calling function to the called function., Types:, • Formal Parameters., • Actual Parameters., 5. Write a note on Local Scope., • A local variable is defined within a block begins and ends with curly braces { }., • The scope of a local variable is the block in which it is defined and cannot be accessed from outside the, block of its declaration., • It is created upon entry and destroyed upon exit into its block., Short Answers, (3 Mark), 5. What are the information the prototype provides to the compiler?, • The function prototype provides details about the return data type, name of the function and a list of, formal parameters or arguments., Example:, • int display(int, int) // function prototype//, • The return value of the function is of type int., • display is the name of the function., • The function is called with two arguments of int data type., 6. What is default arguments? Give example., • In C++, one can assign default values to the formal parameters of a function prototype., • The Default arguments allows to omit some arguments when calling the function., • When calling a function,, • For any missing arguments, complier uses the values in default arguments for the called function., • The default value is given in the form of variable initialization., • The default arguments facilitate the function call statement with partial or no arguments., • The default values can be included in the function prototype from right to left., Example : void defaultvalue(int n1, n2=100);, Explain in detail, (5 Mark), 1. Explain Call by value method with suitable example., • Call by value method copies the value of an actual parameter into the formal parameter of the, function., • In this case, changes made to formal parameter within the function will have no effect on the actual, parameter., Example:, #include<iostream>, using namespace std;, void display(int x), 45, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 46 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , {, int a=x*x;, cout<<"\n\nThe Value inside display function (a * a):"<<a;, }, int main(), {, int a;, cout<<”\nExample : Function call by value:”;, cout<<"\n\nEnter the Value for A :";, cin>>a;, display(a);, cout<<"\n\nThe Value inside main function "<<a;, return(0);, }, Output :, Example : Function call by value, Enter the Value for A : 5, The Value inside display function (a * a) : 25, The Value inside main function 5, 2. What is Recursion? Write a program to find the factorial of the given number using recursion., • A function that calls itself is known as recursive function., • And, this technique is known as recursion., Example to find Factorial of a Number Using Recursion:, #include <iostream>, using namespace std;, int factorial(int); // Function prototype //, int main(), {, int no;, cout<<"\nEnter a number to find its factorial: ";, cin >> no;, cout << "\nFactorial of Number " << no <<" = " << factorial(no);, return 0;, }, int factorial(int m), {, if (m > 1), {, return m*factorial(m-1);, }, else, {, 46, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 47 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , return 1;, }, }, Output :, Enter a number to find its factorial: 5, Factorial of Number 5 = 120, 3. What are the different forms of function return? Explain with example., • Returning from the function is done by using the return statement., • The return statement stops execution and returns to the calling function., • When a return statement is executed, the function is terminated immediately at that point., • A return may or may not have a value associated with it., • If return has a value associated with it, that value becomes the return value for the calling statement., • Even for void function return statement without parameter can be used to terminate the function., Syntax:, return expression/variable;, Example :, return(a+b);, return(a);, return;, // to terminate the function, Returning values:, • The functions that return no value is declared as void., • The data type of a function is treated as int, if no data type is explicitly mentioned., For Example :, int add (int, int);, add (int, int);, • In both prototypes, the return value is int, because by default the return value of a function is of type, int when no return value is explicitly given., Returning Non-integer values:, • A string can also be returned to a calling statement., Example :, #include<iostream>, #include<string.h>, using namespace std;, char *display(), { return (“chennai”); }, int main(), {, char s[50];, strcpy(s,display());, cout<<”\nFunction with Non Integer Return”<<s;, return(0);}, Output :, 47, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 48 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , Function with Non Integer Return Chennai, 4. Explain scope of variable with example., • Scope refers to the accessibility of a variable., • A scope is a region or life of the variable, where variables can be declared,, Inside a block which is called local variables., Inside a function is called function variables., Outside of all functions which is called global variables., Inside a class is called class variable or data members., Types Of Scopes: Local scope, Function scope, File scope and Class scope., i) Local Scope:, • A local variable is defined within a block., • A block of code begins and ends with curly braces { }., • The scope of a local variable is the block in which it is defined., • A local variable cannot be accessed from outside the block of its declaration., • A local variable is created upon entry into its block and destroyed upon exit., ii) Function Scope:, • The scope of variables declared within a function is extended to the function block, and all subblocks therein., • The life time of a function scope variable, is the life time of the function block., • The scope of formal parameters is function scope., iii) File Scope:, • A variable declared above all blocks and functions (including main ( ) ) has the scope of a file., • The life time of a file scope variable is the life time of a program., • The file scope variable is also called as global variable., Example:, #include<iostream>, using namespace std;, int file_var=20;, //Declared within File - file scope variable, void add(int x), {, int m;, //Declaration of variable m in add () - Function scope variable, m=x+30+file_var;, cout<<"\n The Sum = "<<m;, }, int main ( ), {, int a ;, a = 10;, if(a>b), {, 48, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 49 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , int t;, // local to this if block - Local variable, t=a+20;, }, cout<<t;, add(a);, cout<<m;, cout<<”\nThe File Variable = “<<file_var;, return(0);, }, Class Scope:, • A class is a new way of creating and implementing a user defined data type., • Classes provide a method for packing together data of different types., • Data members are the data variables that represent the features or properties of a class., class student, The class student contains mark1, mark2 and, {, total are data variables. Its scope is within the, private :, class student only., int mark1, mark2, total;, };, Scope resolution operator:, • The scope operator reveals the hidden scope of a variable., • The scope resolution operator (::) is used for the following purposes., • To access a Global variable when there is a Local variable with same name., 5. Write a program to accept any integer number and reverse it., #include<iostream>, #include<conio.h>, using namespace std;, int main(), {, int num,r,rev=0;, cout<<"Enter a positive integer:";, cin>>num;, while(num>0), {, r=num%10;, num=num/10;, rev=rev*10+r;, }, cout<<"The reversed number is"<<rev;, getch();, return 0;, }, 49, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 50 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , OUTPUT:, , 12. ARRAYS AND STRUCTURES, , Choose the correct answer, (1 Mark), 1. Which of the following is the collection of variables of the same type that an referenced by a common, name?, a) int, b) float, c) Array, d) class, 2. int age[]={6,90,20,18,2}; How many elements are there in this array?, a) 2, b) 5, c) 6, d) 4, 3. cin>>n[3]; To which element does this statement accept the value?, a) 2, b) 3, c) 4, d) 5, 4. By default, a string ends with which character?, a)\0, b) \t, c) \n, d) \b, Very Short Answers, (2 Mark), 1. What is Traversal in an Array?, • Accessing each element of an array at least once to perform any operation is known as “Traversal”., • Displaying all the elements in an array is an example of “traversal”., 2. What is Strings?, • A string is defined as a sequence of characters where each character may be a letter, number or a, symbol., • Every string is terminated by a null (‘\0’, ASCII code 0) character which must be appended at the end, of the string., 3. What is the syntax to declare two – dimensional array., • The declaration of a 2-D array is, data-type array_name[row-size][col-size];, Short Answers, (3 Mark), 1. Define an Array? What are the types?, • An array is a collection of variables of the same type that are referenced by a common name., • Types Of Arrays :, • One-dimensional arrays, • Two-dimensional arrays, • Multi-dimensional arrays, 50, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 51 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 2. Write note an Array of strings., • An array of strings is a two-dimensional character array., • The size of the first index (rows) denotes the number of strings and the size of the second index, (columns) denotes the maximum length of each string., • Usually, array of strings are declared in such a way to accommodate the null character at the end of, each string., • Example of the 2-D array has the declaration:, char Name[6][10];, Explain in detail, (5 Mark), 1. Write a C++ program to find the difference between two matrix., #include<iostream>, using namespace std;, int main(), {, int arr1[3][3], arr2[3][3], arr3[3][3], sub, i, j;, cout<<"Enter 3*3 Array 1 Elements : \n";, for(i=0; i<3; i++), {, for(j=0; j<3; j++), {, cin>>arr1[i][j];, }, }, cout<<"Enter 3*3 Array 2 Elements : \n";, for(i=0; i<3; i++), {, for(j=0; j<3; j++), {, cin>>arr2[i][j];, }, }, cout<<"Difference between two matrix ... \n";, for(i=0; i<3; i++), {, for(j=0; j<3; j++), {, arr3[i][j]=arr1[i][j]-arr2[i][j];, }, }, for(i=0; i<3; i++), {, for(j=0; j<3; j++), 51, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 52 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , {, cout<<arr3[i][j]<<" ";, }, cout<<"\n";, }, return 0;, }, OUTPUT, , 13. INTRODUTION TO OBJECT ORIENTED PROGRAMMING TECHNIQUES, , Choose the correct answer, (1 Mark), 1. The term is used to describe a programming approach based on classes and objects is, (A) OOP, (B) POP, (C) ADT, (D) SOP, 5. The mechanism by which the data and functions are bound together into a single unit is known as, (A) Inheritance, (B) Encapsulation (C) Polymorphism, (D) Abstraction, 6. Insulation of the data from direct access by the program is called as, (A) Data hiding, (B) Encapsulation (C) Polymorphism, (D) Abstraction, 52, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 53 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 7. Which of the following concept encapsulate all the essential properties of the object that are to be, created?, (A) class, (B) Encapsulation (C) Polymorphism, (D) Abstraction, 8. Which of the following is the most important advantage of inheritance?, (A) data hiding, (B) code reusability, (C) code modification (D) accessibility, 9. “Write once and use it multiple time” can be achieved by, (A) redundancy, (B) reusability, (C) modification, (D) composition, 10. Which of the following supports the transitive nature of data?, (A) Inheritance, (B) Encapsulation (C) Polymorphism, (D) Abstraction, Very Short Answers, (2 Mark), 3. What is polymorphism?, • Polymorphism is the ability of a message or function to be displayed in more than one form., 4. How is encapsulation and abstraction are interrelated?, • Abstraction refers to showing only the essential features without revealing background details., • Classes use the concept of abstraction to define a list of abstract attributes and function which operate, on these attributes., • They encapsulate all the essential properties of the object that are to be created., 5. Write the disadvantages of OOP., • Size:, • Object Oriented Programs are much larger than other programs., • Effort:, • Object Oriented Programs require a lot of work to create., • Speed:, • Object Oriented Programs are slower than other programs, because of their size., Short Answers, (3 Mark), 4. What do you mean by modularization and software reuse?, • Modularisation: Where the program can be decomposed into modules., • Software re-use: Where a program can be composed from existing and new modules., 5. Define information hiding., • Data and Functions are bound together into a single unit is known as Encapsulation., • Encapsulation of data from direct access by the program is called data hiding or information hiding., Explain in detail, (5 Mark), 2. What are the advantages of OOPs?, a) Re-usability:, • “Write once and use it multiple times” you can achieve this by using class., b) Redundancy:, • Inheritance is the good feature for data redundancy., • If you need a same functionality in multiple class you can write a common class for the same, functionality and inherit that class to sub class., , 53, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 54 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , c) Easy Maintenance:, • It is easy to maintain and modify existing code as new objects can be created with small differences to, existing ones., d) Security:, • Using data hiding and abstraction only necessary data will be provided thus maintains the security of, data., 3 Write a note on the basic concepts that supports OOPs?, Main Features of Object Oriented Programming, Encapsulation, • Data and Functions are bound together into a single unit is known as Encapsulation., • Encapsulation is about binding the data variables and functions together in class. It can also be called, data binding., • Encapsulation of data from direct access by the program is called data hiding or information hiding., Data Abstraction, • Abstraction refers to showing only the essential features without revealing background details., • Classes use the concept of abstraction to define a list of abstract attributes and function., • They encapsulate all the essential properties of the object that are to be created., • The attributes are called data members because they hold information., • The functions that operate on these data are called methods or member function., Modularity, • Modularity is designing a system that is divided into a set of functional units (named modules) that can, be composed into a larger application., Inheritance, • Inheritance is the technique of building new classes (derived class) from an existing Class (base, class)., • The most important advantage of inheritance is code reusability., Polymorphism, • Polymorphism is the ability of a message or function to be displayed in more than one form., , 14. CLASSES AND OBJECTS, , Choose the correct answer, (1 Mark), 1. The variables declared inside the class are known as, (A) data, (B) inline, (C) method, (D) attributes, 2. Which of the following statements about member functions are True or False?, i) A member function can call another member function directly with using the dot operator., ii) Member function can access the private data of the class., (A) i)True, ii)True, (B) i)False, ii)True (C) i)True, ii)False, (D) i)False, ii)False, 3. A member function can call another member function directly, without using the dot operator, called as, (A) sub function (B) sub member (C) nesting of member function (D) sibling of member function, 4. The member function defined within the class behave like ........ functions, (A) inline, (B) Non inline, (C) Outline, (D) Data, 54, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 55 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 5. Which of the following access specifier protects data from inadvertent modifications?, (A) Private, (B) Protected, (C) Public, (D) Global, 6. class x, {, int y;, public:, x(int z){y=z;}, } x1[4];, int main(), { x x2(10);, return 0;}, How many objects are created for the above program, (A) 10, (B) 14, (C) 5, (D) 2, Very Short Answers, (2 Mark), 1. What are called members?, • Class comprises of members called as Data Members and Member functions., • Data members are the data variables that represent the features or properties of a class., • Member functions are the functions that perform specific tasks in a class., 2. Differentiate structure and class though both are user defined data type., • The only difference between structure and class is the members of structure are by default public, where as it is private in class., 3. What is the difference between the class and object in terms of oop?, Class, Object, • A class is a template that represents a group of • An identifiable entity with some, objects that share common properties and, characteristics and behaviour is called, relationship., object., • Class is a way to bind the data and its, • The class variables are called object or, associated functions together., instance of class., Example:, Example:, Class Stud, Stud s;, “Stud” is a class, “s” is a object of class Stud., Short Answers, (3 Mark), 1. Rewrite the following program after removing the syntax errors if any and underline the errors:, #include<iostream>, $include<stdio>, class mystud, { int studid =1001;, char name[20];, public, mystud( ) { }, void register ( ), {cin>>stdid; gets(name); }, 55, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 57 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 2. Write with example how will you dynamically initialize objects?, • When the initial values are provided during runtime then it is called dynamic initialization., Example, #include<iostream>, using namespace std;, class X, { int n;, float avg;, public:, X(int p,float q), { n=p;, avg=q; }, void disp(), { cout<<"\n Roll number: " <<n;, cout<<"\n Average : "<<avg; } };, int main(), {, int a ; float b;, cout<<"\n Enter the Roll Number:";, cin>>a;, cout<<"\n Enter the Average:";, cin>>b;, X x(a,b); // dynamic initialization, x.disp();, return 0;, }, OUTPUT, Enter the Roll Number: 1201, Enter the Average 98.6, Roll number: 1201, Average : 98.6, Explain in detail, (5 Mark), 2. Define a class RESORT with the following description in C++ :, Private members:, Rno // Data member to store room number, Name // Data member to store user name, Charges //Data member to store per day charge, Days //Data member to store the number of days, Compute( ) /*A function to calculate total amount as Days * Charges and if the total amount, exceeds 11000 then total amount is 1.02 * Days *Charges */, , 57, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 60 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , cout<<"Roll no : "<<rno<<"\n";, cout<<"Marks : "<<marks<<endl;, }, };, int main(), {, student s(14,70);, s.printdet();, cout<< "Back to Main";, return 0;, }, OUTPUT, , 15. POLYMORPHISM, , Choose the correct answer, (1 Mark), 1. Which of the following refers to a function having more than one distinct meaning?, (A) Function Overloading, (B) Member overloading, (C) Operator overloading, (D) Operations overloading, 2. Which of the following reduces the number of comparisons in a program?, (A) Operator overloading, (B) Operations overloading, (C) Function Overloading, (D) Member overloading, 3. void dispchar(char ch=’$’,int size=10), {, for(int i=1;i<=size;i++), cout<<ch;, }, How will you invoke the function dispchar() for the following input?, To print $ for 10 times, (A) dispchar();, (B) dispchar(ch,size);, (C) dispchar($,10); (D)dispchar(‘$’,10 times);, 60, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 61 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 4. Which of the following is not true with respect to function overloading?, (A) The overloaded functions must differ in their signature., (B) The return type is also considered for overloading a function., (C) The default arguments of overloaded functions are not considered for Overloading., (D) Destructor function cannot be overloaded., 5. Which of the following is invalid prototype for function overloading, a) void fun (intx);, b) void fun (intx);, void fun (char ch);, void fun (inty);, c) void fun (double, d); d) void fun (double d);, void fun (char ch);, void fun (inty);, Very Short Answers, (2 Mark), 1. What is function overloading?, • The ability of the function to process the message or data in more than one form is called as function, overloading., 2. List the operators that cannot be overloaded., Operator that are not overloaded are follows, • Scope operator (::), • Sizeof, • Member selector (.), • Member pointer selector (✳), • Ternary operator (?:), 3. class add{int x; public: add(int)}; Write an outline definition for the constructor., Answer:, add (int temp), {, x = temp;, }, 4. Does the return type of a function help in overloading a function?, • No. The return type of overloaded functions are not considered for overloading same data type., 5. What is the use of overloading a function?, • Function overloading reduces the number of comparisons in a program and makes the program to execute, faster., • It also helps the programmer by reducing the number of function names to be remembered., Short Answers, (3 Mark), 1. What are the rules for function overloading?, 1. The overloaded function must differ in the number of its arguments or data types, 2. The return type of overloaded functions are not considered for overloading same data type, 3. The default arguments of overloaded functions are not considered as part of the parameter list in, function overloading., , 61, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 62 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 2. How does a compiler decide as to which function should be invoked when there are many, functions? Give an example., • When you call an overloaded function, the compiler determines the most appropriate definition to use,, by comparing the argument types you have used to call the function with the parameter types specified, in the definitions., • The process of selecting the most appropriate overloaded function or operator is called overload, resolution., Example:, float area ( float radius);, float area ( float half, float base, float height );, float area ( float length , float breadth);, • The function “area” can be called using proper number of arguments in function call statement., 3. What is operator overloading? Give some examples of operators which can be overloaded., • The term Operator overloading, refers to giving additional functionality to the normal C++ operators, like +,++,-,—,+=,-=,*.<,>., • It is also a type of polymorphism in which an operator is overloaded to give user defined meaning to it, • For example '+' operator can be overloaded to perform addition on various data types, like for Integer,, String(concatenation) etc., Explain in detail, (5 Mark), 1. What are the rules for operator overloading?, 1. Precedence and Associativity of an operator cannot be changed., 2. No new operators can be created, only existing operators can be overloaded., 3. Cannot redefine the meaning of an operator’s procedure. You cannot change how integers are added., Only additional functions can be given to an operator, 4. Overloaded operators cannot have default arguments., 5. When binary operators are overloaded, the left hand object must be an object of the relevant class, 4. Answer the questions based on the following program, #include<iostream>, #include<string.h>, using namespace std;, class comp {, public:, char s[10];, void getstring(char str[10]), { strcpy(s,str); }, void operator==(comp);, };, void comp::operator==(comp ob), { if(strcmp(s,ob.s)==0), 62, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 63 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , cout<<"\nStrings are Equal";, else, cout<<"\nStrings are not Equal"; }, int main(), { comp ob, ob1;, char string1[10], string2[10];, cout<<"Enter First String:";, cin>>string1;, ob.getstring(string1);, cout<<"\nEnter Second String:";, cin>>string2;, ob1.getstring(string2);, ob==ob1;, return 0; }, (i) Mention the objects which will have the scope till the end of the program., , • Object ob and ob1 in the main() function will have the scope till the end of the program., (ii) Name the object which gets destroyed in between the program, , • Object ob in operator==(comp ob) function gets destroyed in between the program., (iii) Name the operator which is over loaded and write the statement that invokes it., , • == is the overloaded operator in the program., • The invoking statement of operator overloading in the program is ob == ob1;, (iv) Write out the prototype of the overloaded member function, , • The prototype of the overloaded member function is void comp :: operator = = (comp ob), (v) What types of operands are used for the overloaded operator?, , • User defined datatype class objects are used for the overloaded operator., (vi) Which constructor will get executed in the above program? Write the output of the program, • Constructor is not defined in the class. So compiler generated default constructor and it will executed, , 63, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 64 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 16. INHERITANCE, , Choose the correct answer, (1 Mark), 1. Which of the following is the process of creating new classes from an existing class, (a) Polymorphism, (b) Inheritance, (c) Encapsulation, (d) super class, 2. Which of the following derives a class student from the base class school, (a) school: student, (b) class student : public school, (c) student : public school, (d) class school : public student, 3. The type of inheritance that reflects the transitive nature is, (A) Single Inheritance, (B) Multiple Inheritance, (C) Multilevel Inheritance, (D) Hybrid Inheritance, 5. Inheritance is a process of creating new class from, (A) Base class, (B) abstract, (C) derived class, (D) Function, 6. A class is derived from a class which is a derived class itself, then this is referred to as, (A) multiple inheritance, (B) multilevel inheritance, (C) single inheritance, (D) double inheritance, Very Short Answers, (2 Mark), 1. What is inheritance?, • The mechanism of deriving new class from an existing class is called inheritance., 2. What is a base class?, • A class that is used as the basis for creating a new class is called a super class or base class., , 64, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 65 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 3. Why derived class is called power packed class?, • The derived class inherits all the properties of the base class., • It is a power packed class, as it can add additional attributes and methods and thus enhance its, functionality., 4. In what multilevel and multiple inheritance differ though both contains many base class?, Multilevel Inheritance:, In multilevel inheritance, the constructors will be executed in the order of inheritance., Multiple Inheritance:, If there are multiple base classes, then it starts executing from the left most base class., 5. What is the difference between public and private visibility mode?, public, private, , • When a base class is inherited with public • When a base class is inherited with private, visibility mode , the protected members of the, base class will be inherited as protected, members of the derived class and the public, members of the base class will be inherited as, public members of the derived class., , visibility mode the public and protected, members of the base class become ‘private’, members of the derived class, , Short Answers, (3 Mark), 1. What are the points to be noted while deriving a new class?, The following points should be observed for defining the derived class., i) The keyword class has to be used, ii) The name of the derived class is to be given after the keyword class, iii) A single colon (:), iv) The type of derivation (the visibility mode), namely private, public or protected., If no visibility mode is specified, then by default the visibility mode is considered as private., v) The name of the base class (parent class), if more than one base class, then it can be given separated by, comma., 2. What is difference between the members present in the private visibility mode and the members, present in the public visibility mode, Members present in the private visibility mode:, • Can be accessed only by the class members., • By default the members will be in private visibility mode., • When classes are inherited, private members are not inherited., Members present in the public visibility mode:, • Can be accessed by the outside members also., • Members, to be in public visibility mode has to be specified explicitly., • When classes are inherited, the public members are inherited as private, protected and public members, of the derived class., , 65, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 66 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 3. What is the difference between polymorphism and inheritance though are used for reusability, of code?, Polymorphism:, • Reusability of code is implemented through functions (or) methods., • Polymorphism is the ability of a function to respond differently to different message., • Polymorphism is achieved through function and operator overloading., Inheritance:, • Reusability of code is implemented through classes., • Inheritance is the process of creating derived classes from the base class or classes., • Inheritance is achieved by various types of inheritances namely single, multiple, multilevel, hybrid and, hierarchical inheritances., Explain in detail, (5 Mark), 1. Explain the different types of inheritance, There are different types of inheritance viz., Single Inheritance, Multiple inheritance, Multilevel, inheritance, hybrid inheritance and hierarchical inheritance., 1. Single Inheritance, When a derived class inherits only from one base class, it is known as single inheritance, 2. Multiple Inheritance, When a derived class inherits from multiple base classes it is known as multiple inheritance, 3. Hierarchical inheritance, When more than one derived classes are created from a single base class , it is known as Hierarchical, inheritance., 4. Multilevel Inheritance, The transitive nature of inheritance is reflected by this form of inheritance. When a class is derived from a, class which is a derived class – then it is referred to as multilevel inheritance., 5. Hybrid inheritance, When there is a combination of more than one type of inheritance, it is known as hybrid inheritance., Hence, it may be a combination of Multilevel and Multiple inheritance or Hierarchical and Multilevel, inheritance or Hierarchical, Multilevel and Multiple inheritance., , 66, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 68 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , Very Short Answers, (2 Mark), 1. What is harvesting?, • A person or program collects login and password information from a legitimate user to illegally gain, access s to others’ account(s)., 2. What are Warez?, Commercial programs that are made available to the public illegally are often called Warez., 3. Write a short note on cracking., • Cracking is where someone edits a program source so that the code can be exploited or modified., • “Cracking” means trying to get into computer systems in order to steal, corrupt, or illegitimately view, data., • A cracker is a malicious or criminal hacker., Short Answers, , (3 Mark), , 3. Explain about proxy server., 4. What are the guidelines to be followed by any computer user?, • Honesty: Users should be truthful while using the internet., • Confidentiality: Users should not share any important information with unauthorized people., • Respect: Each user should respect the privacy of other users., • Responsibility: Each user should take ownership and responsibility for their actions, Explain in detail, (5 Mark), 1. What are the various crimes happening using computer?, Crime, Function, • Malicious programs that can perform a variety of functions including, Malware, monitoring user’s computer activity without their permission., Harvesting, , • A person or program collects login and password information from a, legitimate user to illegally gain access s to others’ account(s)., , Spam, , • Distribute unwanted e-mail to a large number of internet users., , Cyber Terrorism, Cyber stalking, , • Hacking, threats, and blackmailing towards a business or a person., • Harassing through online., , Scam, , • Tricking people into believing something that is not true, , 2. What is piracy? Mention the types of piracy? How can it be prevented?, • Software Piracy is “unauthorized copying of software”., • It includes stealing of codes / programs and other information illegally and creating duplicate copies by, unauthorized means and utilizing this data either for one’s own benefit or for commercial profit., , 68, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 69 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , • Most of the commercial software is licensed for use at a single computer site or for use by only one, user at any time., • When a user buys any software, he becomes a licensed user for that software., • He is allowed to make copies of the program for backup purposes, but it is against the law to distribute, duplicate copies to others., • Such illegal copying and distribution of commercial software should not be practiced., • An entirely different approach to software piracy is called shareware, acknowledges the futility of, trying to stop people from copying software and instead relies on people’s honesty., • Shareware publishers encourage users to give copies of programs to friends and colleagues but ask, everyone who uses that program regularly to pay a registration fee to the program’s author directly., • Commercial programs that are made available to the public illegally are often called warez., PREVENTION:, • To pretend being your friend and talk to you on Internet Relay Chat(IRC) or by Instant messenger,, e-mail can also be a source for them., • They may send official e-mail requesting some sensitive information., , 18. TAMIL COMPUTING, , Very Short Answers, (2 Mark), 1. List the search engines supported by Tamil language., • Google, • Bing, • Yahoo, 2. What are the keyboard layouts used in Android?, • Sellinam and Ponmadal – are familiar Tamil keyboard layouts that works on Android operating system, in Smart phone using phonetics., 3. Write a short note about Tamil Programming Language., • Programming languages to develop software in computers and smart phones are available only in, English., • Based on Python programming language, the first Tamil programming language “Ezhil” (எ�ல் ) is, designed., 4. What is TSCII?, • TSCII (Tamil Script Code for Information Interchange) is the first coding system to handle our Tamil, language., • This encoding scheme was registered in IANA (Internet Assigned Numbers Authority) a unit of, ICANN., 69, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER
Page 70 :
J. ILAKKIA M.Sc., B.Ed., M.Phil. Computer Instructor Grade-I, GHSS – V.Pagandai, Villupuram., , 5. Write a short note on Tamil Virtual Academy., • Tamil Virtual University was established on 17th February 2001 by the Govt. of Tamilnadu., • Now, this organisation functions with the name of “Tamil Virtual Academy”., • It offers different courses in Tamil language, Culture, heritage etc., from kindergarten to under, graduation level., ***, , PREPARED BY, , J. ILAKKIA M.Sc., B.Ed., M.Phil., Computer Instructor Grade-I, , Govt. Hr. Sec. School, V.Pagandai, Villupuram 605 501., , 70, , Visit :http://www.youtube.com/c/CSKNOWLEDGEOPENER, , CS KNOWLEDGE OPENER