12th Computer Science Study Hub
12th Computer Science Lesson 1
Functions Important 5 Marks Questions
Prepare effectively for the Tamil Nadu 12th Computer Science public examination with important 5 marks questions collected from previous year question papers and repeated school examination questions.
Lesson 1 β Functions
Important 5 Marks Questions with Previous Year Repetition Analysis.
Important 5 Marks Questions from Previous Year Question Papers
The important 5 marks questions provided here are collected from the last 6 years Tamil Nadu State Board public examination question papers and important school examinations.
π Note for Students
The number mentioned next to each question indicates how many times the question has been repeated in previous public examinations and school examinations. Questions with higher repetition counts are more important for board exam preparation.
1.What are called Parameters and write a note on i) Parameter without Type ii) Parameter with Type (9) Ch1 Q1
Parameters are the variables in a function definition and arguments are the values which are passed to a function definition.
Parameter without Type
(requires: b>=0 )
(returns: a to the power of b)
let rec pow a b:=
if b=0 then 1
else a * pow a (b-1)
- In the function definition,
bis the parameter and the value passed tobduring a function call is called an argument. - The precondition (
requires) specifies the condition that must be satisfied before the function is executed. - The postcondition (
returns) specifies the result produced by the function after execution. - In the given function, data types are not explicitly mentioned. Some programming language compilers can automatically determine the data types using a process called type inference.
π Type Inference in the Function
- In the above function definition if expression can return 1 in the then branch, shows that as per the typing rule the entire if expression has type int.
- Since the if expression is of type βintβ, the function’s return type also be βintβ.
- βbβ is compared to 0 with the equality operator, so βbβ is also a type of βintβ.
- Since βaβ is multiplied with another expression using the * operator, βaβ must be an int.
Parameter with Type
(requires: b>=0 )
(returns: a to the power of b )
let rec pow (a: int) (b: int) : int :=
if b=0 then 1
else a * pow a (b-1)
- When we write the type annotations for βaβ and βbβ the parentheses are mandatory.
- Generally we can leave out these annotations, because it’s simpler to let the compiler infer them.
- There are times we may want to explicitly write down types.
- This is useful on times when you get a type error from the compiler that doesn’t make sense.
- Explicitly annotating the types can help with debugging such an error message.
The syntax to define functions is close to the mathematical usage: the definition is introduced by the keyword let, followed by the name of the function and its arguments; then the formula that computes the image of the argument is written after an := sign. If you want to define a recursive function: use βlet recβ instead of βletβ.
12th Computer Science Lesson 1 Functions Important 5 Marks Questions
Welcome to our collection of 12th Computer Science Lesson 1 Functions Important 5 Marks Questions and Answers prepared from previous year public question papers and repeated school examination questions.
The lesson Functions is one of the most important chapters in Class 12 Computer Science. Long answer questions are frequently asked from recursive functions, parameter passing, scope of variables, lambda functions, and function-based programming concepts.
Topics Covered
- Functions and Their Types
- Recursive Functions
- Lambda Functions
- Anonymous Functions
- Parameter Passing Techniques
- Scope of Variables
- Function Calls and Returns
- Problem Solving Using Functions
Benefits of Practicing 5 Mark Questions
- Improves detailed answer writing skills
- Strengthens programming concepts
- Covers repeated board exam questions
- Enhances logical thinking
- Useful for final revision
- Improves examination confidence
Previous Year Important Questions
These important 5 marks questions are collected from Tamil Nadu State Board public examinations and important school examinations conducted during the past few years.
Students should practice writing answers with proper explanations, algorithms, and examples wherever applicable to score maximum marks in the public examination.
More 12th Computer Science Study Materials
- Important 1 Mark Questions
- Important 2 Mark Questions
- Important 3 Mark Questions
- Book Back Answers
- Chapter Wise Notes
- Previous Year Question Papers
- Video Tutorials
Regular practice of important questions from Functions can help students improve confidence and score high marks in the 12th Computer Science public examination.
