Macro as function IT 402 – Important Questions and Answers

In this article, we will discuss some important questions and answers for the topic Macro as function IT 402. So here we go!!!!

Objective type questions – Macro as function IT 402

In this section, we will discuss 1 mark questions like the file in the blanks, MCQs, and True and False. So let’s begin!!!

Fill in the blanks – macro as function IT 402

  1. To create a function in visual basic editor click on _______________ –> __________ option. Insert –> Module
  2. The __________ is used to write instructions or commands in visual basic editor. function
  3. Click on ___________ –> __________ option from code group to open visual basic editor from MS Excel. Developer, Visual Basic
  4. The visual basic editor converts first letter into capital for __________. Keywords
  5. The function will start with as ___________ keyword in Visual Basic editor. Function (F must be capital)
  6. The function in Visual Basic ends with ______ ________. End Function.
  7. The names for values used in a function, written in the brackets are known as ___________. Parmeters or Arguments
  8. To access cells directly from excel into Visual Basic code editor provides _______ function. range

True/False – macro as function IT 402

  1. User can create their own functions or formulas in MS excel. True
  2. Users can create a new function from the developer tab. True
  3. The visual basic editor opens a module when you click on Developer –> Visual Basic option from code group in MS Excel. False
  4. Every name in Visual Basic must be written followed by As keyword. True
  5. The function created in visual basic will automatically take place in functions group in MS Excel. True
  6. The range() function is used to change access columns only in the visual basic code editor. Falser
  7. range(A1).value will access the value written in A1. True
  8. You can any number of values in functions created in visual basic editor. False

MCQs – macro as function IT 402

  1. Which of the following is the correct statement to write a function in Visual Basic editor:
    1. function MyFunction(val1 As Integer) As Integer …….. End Function
    2. Function MyFunction(val1 As Integer) As Integer ……. End Function
    3. MyFunction(val1 As Integer) As Integer…….End Function
    4. Function MyFunction(val1 As Integer) As Integer ……. EndFunction
  2. A ________ is a reserved word of Visual Basic.
    1. Keyword
    2. Main word
    3. Default Word
    4. Return
  3. The worksheet of MS excel is considered as ____________ in Visual Basic editor.
    1. File
    2. Module
    3. Function
    4. Object
  4. The macro name given in MS excel is considered as ____________ in Visual Basic editor.
    1. Sub
    2. Module
    3. Function
    4. Object
  5. The range() function visual basic accepts _____________ number parameters.
    1. 1
    2. 2
    3. 3
    4. 4

Short answer questions

  1. Explain the following parts of the visual basic editor window which is used to write a function.
    • Projects – This window helps to select the part of MS excel objects like worksheets or workbooks and modules.
    • Properties: Ths window help to select the various properties of the selected object of visual basic.
    • Code window: It offers a space to write code for the function.
  2. Write a function to compute fare by taking two parameters: fare and distance
    • To do this use a function name in the following manner:
Function Fare(d as Integer, ch as Integer)As Integer
   Fare = d * ch
End Function

3. Write a macro code to assign the customer category based on the following conditions:

Bill AmountCategory
More than 1500Gold
1000 to 1500Silver
Less Than 1000Platinum

Assume that the amount is entered in the B column and the worksheet contains data of 10 customers. The first row is the Header row. Assign the category in Column C.

Sub Assign_Category()
    For i = 2 to 11 
    If Range("B" & i).Value> 1500 Then
       Range("C" & i).Value = "Gold"
    Else If Range("B" & i).Value> 1000 and Range("B" & i).Value< 1500 Then
       Range("C" & i).Value = "Silver"
    Else 
      Range("C" & i).Value = "Platinum"
    End If
End Sub

That’s all from the questions and answers.

The programming part is not essential for class 10 students. But as the topic is given your curriculum and we don’t have any appropriate content for this topic.

I have prepared these contents according to my best knowledge. If something is missing or something is very high level according to you, please post your doubt in the comment section.

Thank you for reading this article.

Information technology

Comment Your Views

%d bloggers like this: