CBSE Class 11 C++ Sample Paper-3
Class- XI [Computer Science]
Time Duration: 3 Hrs
M. M. 70
(i) All questions are compulsory
(ii) Programming language : C++
1. Explain any 2 important features of an Operating System. 2
There are various features of an Operating System. These are:
- Memory Management
- File Management
- Hardware Interdependence
- Process Management
- Graphical User Interface
- Networking Capability.
Memory Management: Memory management is the functionality of an operating system which handles or manages primary memory and moves processes back and forth between main memory and disk during execution.
File Management : Operating System helps to create new files in computer system and placing them at the specific locations. It helps in easily and quickly locating these files in computer system. It makes the process of sharing of the files among different users very easy and user friendly.
2. What is the difference between GUI and CUI? 2
A GUI (Graphic User Interface) is a graphical representation in which the users can interact with software or devices through graphical icons.
A CLI (Command Line Interface) is a console or text based representation in which the user types the commands to operate the software or devices.
3. What is the difference between copying and moving a file. 2
Copy is to make a copy of the selected file or folder and place the duplicate in another drive or folder, while move is to move the original files from one place to another location. The move command deletes the original files, while copy retains them.
1. Explain the following terms with an example of each. (2 marks each)
a. Comments : In computer programming, a comment is a programmer-readable explanation or annotation in the source code of a computer program. Comments are statements that are not executed by the compiler and interpreter.
In C/C++ there are two types of comments :
Single line comment
Refer: Comments in C++
Identifiers are used as the general terminology for naming of variables, functions and arrays. These are user defined names consisting of arbitrarily long sequence of letters and digits with either a letter or the underscore(_) as a first character. Identifier names must differ in spelling and case from any keywords. You cannot use keywords as identifiers; they are reserved for special use. Once declared, you can use the identifier in later program statements to refer to the associated value. A special kind of identifier, called a statement label, can be used in goto statements.
Refer: C++ Tokens
2. What do you mean by Programming Errors? Explain all types of errors. 3
Error is an illegal operation performed by the user which results in abnormal working of the program.
Type of errors :
- Syntax errors : Errors that occur when the rules of writing C/C++ syntax are violated are known as syntax errors. This compiler error indicates something that must be fixed before the code can be compiled. All these errors are detected by compiler and thus are known as compile-time errors.
- Run-time Errors : Errors which occur during program execution(run-time) after successful compilation are called run-time errors. Example: Division by zero error.
- Logical Errors : On compilation and execution of a program, desired output is not obtained when certain input values are given. These types of errors which provide incorrect output but appears to be error free are called logical errors.
Refer: Errors in C++
3. Explain the term LIVEWARE. 1
The programmers, systems analysts, operating staff, and other personnel working in a computer system or the organisation related to a computing environment is termed as Liveware.
1. Write a program to read a number from user and check whether the given no. is prime. 5
You may Refer : Check if a number is prime or not
2. Write a function to calculate the following series: 1 + X / X2 + 2X / X3+ 3X / X4 +…………….. + NX / XN+1
3. Evaluate the following C++ expressions where a, b, c are integers and d, f are floating point numbers. The Value of a = 6, b = 2, d = 1.5 (2 marks each)
a) f = a + b/a
b) c = ( a++) * d + b
c) c = a – ( b++ ) * (–a)
4. Find out the errors, underline them and correct them 4
5. Write a program to find factorial of a given number. 4
6. Write a function to accept a String Str, a character Ch and an integer pos. Now in String ‘Str’ character at position ‘pos’ should be replaced with character ‘Ch’ 4
7. Write a program to read a Matrix ant print the Transpose of that Matrix . 4
8. a. What are the types of selection statements available in C++? Give example of each type. 2
Selection statements in programming languages decides the direction of flow of program execution. Decision making statements available in C++ are:
- if statement
- if..else statements
- nested if statements
- if-else-if ladder
- switch statements
Refer : Decision making in C/C++
b Differentiate between system software and application software. 2
- System Software: These are the software that directly allows the user to interact with the hardware components of a computer system. The system software can be called the main software of a computer system as it handles the major portion of running a hardware.
Example: Operating System
- Application Software: These are the basic software used to run to accomplish a particular action and task. These are the dedicated software, dedicated to performing simple and single tasks.
Example: Microsoft Excel – Used to prepare excel sheets.
Refer: Software Concepts
c. Differentiate between compiler and interpreter. 2
- A compiler takes entire program and converts it into object code which is typically stored in a file. The object code is also referred as binary code and can be directly executed by the machine after linking.
Examples: C and C++.
- An Interpreter directly executes instructions written in a programming or scripting language without previously converting them to an object code or machine code.
Examples: Perl, Python and Matlab.
Refer: Compiler vs Interpreter
d. Explain unary, binary and ternary operators? Give example of each type. 3
- Unary Operators: Operators that operates or works with a single operand are unary operators.
Example: (++, –)
- Binary Operators: Operators that operates or works with two operands are binary operators.
Example: +, –, *, /.
- Ternary Operator: These operator requires 3 expressions or operands to function.
Example: Conditional operator- Expression1 ? Expression2 : Expression3 .
Here, Expression1 is the condition to be evaluated. If the condition(Expression1) is True then we will execute and return the result of Expression2 else return the result of Expression3.
Refer: Operators in C++
e. What is the difference between break and continue? Give example. 3
- Break statement:
the break statement terminates the smallest enclosing loop (i. e., while, do-while, for or switch statement)
- Continue statement:
the continue statement skips the rest of the loop statement and causes the next iteration of the loop to take place.
Refer: Break and Continue statement
1. What are memory devices? Discuss RAM and ROM in detail 4
- Random Access Memory (RAM) : It is also called as read write memory or the main memory or the primary memory. The programs and data that the CPU requires during execution of a program are stored in this memory.
It is a volatile memory as the data loses when the power is turned off.
- Read Only Memory (ROM) : Stores crucial information essential to operate the system, like the program essential to boot the computer.
It is not volatile and always retains its data. ROMs are used in embedded systems or where the programming needs no change.
Refer: RAM and ROM
2. Explain the following terms ( 1 mark each)
a. REGISTER :These are the special fast storage devices which are used to store data directly in the CPU. A CPU contains a register file containing several registers to store the data which is currently in execution in CPU.
b. ALU : The arithmetic logic unit is that part of the CPU that handles all the calculations the CPU may need, e.g. Addition, Subtraction, Comparisons. It performs Logical Operations, Bit Shifting Operations, and Arithmetic Operation
c. NON-IMPACT PRINTER : These printers use non-Impact technology such as ink-jet or laser technology. There printers provide better quality of O/P at higher speed.
Example: Ink-Jet Printer
3. What is the difference between online and offline UPS? 2
Online UPS systems draw their power through power conditioning and charging components during normal operations.
Offline UPS are systems where the load is fed directly from the raw mains during normal operations, rather than the inverter outputs, to the extent that power storage components such as chargers, inverters and batteries are offline as the load is concerned.