Pakistani.education

← Sindh Board notes

اے آئی مسودہ — ابھی کسی استاد نے جانچا نہیں۔ اپنے استاد سے تصدیق کریں۔

Computer Science · Class 10 · Chapter 12: Functions

8 min

Key points

Definitions

Function
A function is a sub-program or sub-routine that performs a specific task and can be called from the main program or from another function
Function Declaration
Function declaration tells the compiler about the function name, return type, and parameters but does not contain the function body
Function Definition
Function definition contains the actual statements or code that executes when the function is called
Built-in Functions
Built-in functions are pre-defined functions provided by C language such as printf(), scanf(), sqrt(), pow() etc.
User-defined Functions
User-defined functions are created by the programmer according to program requirements to perform specific tasks

Worked example

Define function and determine whether the relation f = {(1,2), (2,4), (3,6), (4,8)} is a function or not. Also find its domain and range. (5 marks)

Definition: A function is a relation in which each element of the domain is paired with exactly one element of the range. Checking the relation: Each input value (1,2,3,4) maps to exactly one output value, so this is a function. Domain = {1,2,3,4}, Range = {2,4,6,8}

Common mistakes

Quick recap

A function is a special relation where each domain element maps to exactly one range element. Remember the vertical line test for graphs - if any vertical line intersects the curve more than once, it's not a function. Types include one-to-one (injective), onto (surjective), and bijective functions. Always write domain and range in proper set notation.

Generated by AI from Sindh Textbook Board material; review state: ai_unreviewed. MCQs, past-paper references and examiner notes are held back until a teacher has checked them.