Computer_Science_Question_Paper_with_Answers
Computer_Science_Question_Paper_with_Answers
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:
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.
- 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.
- 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.
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.