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

Cbse Class 10 MACRO QUESTIONS/Assignments Create Macros To Behave Like Function 1. Ans: 2. Ans 3. Ans: 4. Ans: 5

The document discusses creating macros in CBSE Class 10 that behave like functions to perform various tasks like printing values, messages, performing calculations, and evaluating conditional logic. 14 examples are provided that demonstrate defining functions with and without arguments to add, multiply, find largest/smallest, check conditions, and evaluate expressions.

Uploaded by

Vijay deals
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
599 views

Cbse Class 10 MACRO QUESTIONS/Assignments Create Macros To Behave Like Function 1. Ans: 2. Ans 3. Ans: 4. Ans: 5

The document discusses creating macros in CBSE Class 10 that behave like functions to perform various tasks like printing values, messages, performing calculations, and evaluating conditional logic. 14 examples are provided that demonstrate defining functions with and without arguments to add, multiply, find largest/smallest, check conditions, and evaluate expressions.

Uploaded by

Vijay deals
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

CBSE CLASS 10

MACRO QUESTIONS/Assignments

Create Macros to behave like function


To print number 5 whenever the function five() is called
1.
Function five()
Ans: Five=5
End function
To print your name whenever the function myname() is called
2.
function myname()
Ans myname=”hulk”
end function
To print school Address whenever the function school() is called
3.
function school()
Ans: school="hulimavu"
end function
To create a message ‘Hello all’ whenever msg() is called
4.
function msg()
Ans: msgbox("hello all")
end function
To print double the value of a number when double(n) is called
5.
function double(p)
double=p*2
end function
Ans: or
function double(p)
double=p+p
end function
Print cube of a number when passed it as argument cube(n)
6.
function cube(x)
Ans: cube=x*x*x
end function
Add 5 to the number passing a number as argument sum5(n)
7.
function sum5(x)
Ans: sum5=x+5
end function
To find the product of 2 numbers whenever prod2 is called with 2 numbers passed as
arguments.
8.

Ans: function prod2(x,y)


prod2=x*y
end function
To find the largest of two numbers
9.
function large2(x,y)
if a>=b then
large2=a
Ans: else
large2=b
endif
end function
10. To find the smallest of two numbers
function small(x,y)
if a<=b then
small=a
else
small=b
endif
end function

11 to check if age entered is senior citizen or not


function age(a)
if a>=60 then
age="senior citizen"
else
age="not senior citizen"
endif
end function

12 function sumvar()
DIM a as integer
Dim b as double
a=2
b=4
sumvar=a+b
end function

ind the sum of the expression a*b/c+d^2 passing a,b,c,d as parameter


13 function name express1(a,b,c,d)

function express1(a,b,c,d)

express1=a*b/c+d^2
end function

find the sum of the expression a*b/c+d^2 without passing a,b,c,d as parameter
function name express2(a,b,c,d)
14 function express2()
dim a as integer
dim b as integer
dim c as integer
dim d as integer
a=2
b=2
c=2
d=2
express2=a*b/c+d^2
end function

1.

You might also like