0% found this document useful (0 votes)
4 views

Computer_Science_Question_Paper_with_Answers

The document is a computer science question paper covering various programming concepts. It includes questions on operators, recursion, control structures, keywords, constants, identifiers, pointers, and arrays. Each section requires explanations and definitions, with specific marks allocated for each question.

Uploaded by

tanishatayal26
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Computer_Science_Question_Paper_with_Answers

The document is a computer science question paper covering various programming concepts. It includes questions on operators, recursion, control structures, keywords, constants, identifiers, pointers, and arrays. Each section requires explanations and definitions, with specific marks allocated for each question.

Uploaded by

tanishatayal26
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Computer Science Question Paper

Marks: 10

Q1. What is an Operator? Explain all the types of operators and their symbols. (10 marks)

An operator is a symbol that tells the compiler or interpreter to perform specific mathematical,
relational, or logical operations. Operators in programming are used to manipulate data and
variables. Here are the main types of operators:

1. Arithmetic Operators: Used to perform basic mathematical operations.


+ (Addition), - (Subtraction), * (Multiplication), / (Division), % (Modulus)

2. Relational Operators: Used to compare two values.


== (Equal to), != (Not equal to), > (Greater than), < (Less than), >= (Greater than or equal to), <=
(Less than or equal to)

3. Logical Operators: Used to perform logical operations.


&& (Logical AND), || (Logical OR), ! (Logical NOT)

4. Assignment Operators: Used to assign values to variables.


= (Assign), +=, -=, *=, /= (Compound assignment)

5. Bitwise Operators: Used to perform operations on bits.


& (Bitwise AND), | (Bitwise OR), ^ (Bitwise XOR), ~ (Bitwise NOT), << (Left shift), >> (Right shift)

Q2. Define Recursion. Explain Call by Value and Call by Reference. (5 marks)

Recursion: Recursion is a programming technique where a function calls itself in order to solve a
problem. Each recursive call works on a smaller version of the original problem until it reaches a
base case, at which point it returns back up the call stack.

Call by Value: In call by value, the function receives a copy of the argument's value. Changes made
to the parameter within the function do not affect the original variable.
Call by Reference: In call by reference, the function receives a reference to the original variable. Any
changes made to the parameter affect the original variable.

Q3. Explain the difference between: (5 marks)

- If and If-Else: If checks a condition, and if it is true, executes the statements inside. If the condition
is false, nothing happens. If-Else provides an alternative path; if the condition is false, it executes
the statements inside the else block.

- Do and Do-While: Do is part of the do-while loop which executes at least once before checking the
condition. Do-While checks the condition after executing the loop's code block, ensuring it runs at
least once.

- Break, Continue, and Exit: Break exits a loop or switch statement immediately. Continue skips the
current iteration and moves to the next iteration in a loop. Exit terminates the entire program.

Q4. Define the following terms: (1 mark each)

- Keyword: Reserved words in programming languages with special meaning, e.g., int, return.
- Constant: A value that does not change throughout the program, e.g., const int PI = 3.14.
- Identifier: A name given to variables, functions, or arrays by the programmer.
- Character: A single letter, digit, or symbol, often represented by char type.
- Pointer: A variable that stores the memory address of another variable, used for efficient memory
manipulation.

Q5. Define Arrays. (4 marks)

An array is a collection of elements of the same data type stored in contiguous memory locations.
Arrays are used to store multiple values in a single variable. Each element in an array can be
accessed by its index. For example, int arr[5] defines an array of 5 integers.

You might also like