VB.NET Questions Answers- VB.NET procedures (PartII)


VB.NET procedures (PartII)

1. Find any errors in the following function definition:
Sub myfunc(x As Integer,y As Integer)
  Cosole.WriteLine(x*y)
  return(x*y)
End Sub
Check answer 2. Find any errors in the following function definition:
Function  myfunc(int x,y) As Integer
    return(x*y)
End Sub
Check answer 3. What would be the output from the following VB.NET program when run using 3 and 4 as input data?
Module Module1
   
      Sub Main()
          Dim x,y,res As Integer
        Console.Write("Enter x:")
        x=Integer.Parse(Console.ReadLine())
        Console.Write("Enter y:")
        y=Integer.Parse(Console.ReadLine())
        res=subtr(x,y)
        Console.WriteLine("Result={0}",res)
        Console.ReadLine() 'wait for keypress
     End Sub

     Function subtr( x As Integer,y As Integer) As Integer
        return(x-y)
     End Function
  
End Module Check answer 4.What would be the output from the following VB.NET program when run using 2, 4, and 1 as input data?

Module Module1
   
      Sub Main()
     
          Dim x,y,z,max As Integer
          Console.Write("Enter x, y and z separated by enter keys:")
          x=Integer.Parse(Console.ReadLine())
          y=Integer.Parse(Console.ReadLine())
          z=Integer.Parse(Console.ReadLine())
          max=max3(x,y,z)
          Console.WriteLine("The max value is {0}.",max)
          Console.ReadLine()
     End Sub

     Function max3(ByVal x As Integer, ByVal y As Integer, ByVal z As Integer) As Integer
         If (x > y) Then
             If (x > z) Then
                   Return x
             Else
                 Return z
             End If
        ElseIf (y > z) Then
             Return y
        Else
             Return z
        End If
     End Function
End Module
Check answer 5.What would be the output from the following VB.NET program when run a.using 3 and 2 as input data?      b. using 3 and -2 as input data?
Module Module1
   
      Sub Main()
           Dim b,p As Integer
           Dim res As Double
           Console.Write("Enter base value:")
           b=Integer.Parse(Console.ReadLine())
           Console.Write("Enter power:")
           p=Integer.Parse(Console.ReadLine())
           res=mypower(b,p)
          Console.WriteLine("Result={0}",FormatNumber(res,5))
 

       End Sub

      Function mypower(ByVal base As Integer, ByVal pow As Integer) As Double
          If (pow >= 0) Then 'positive power
               If (pow = 0) Then
                    Return 1
               ElseIf (pow = 1) Then
                    Return base
               Else : Return (base * mypower(base, pow - 1))
               End If
          Else 'negative power
              If (pow = -1) Then
                   Return (1 / CDbl(base))
              Else : Return ((1 / CDbl(base) * mypower(base, pow + 1)))
              End If
         End If
    End Function
End Module
Check answer


Comments

seo comment

 seo

Hello Web Admin, I noticed that your On-Page SEO is is missing a few factors, for one you do not use all three H tags in your post, also I notice that you are not using bold or italics properly in your SEO optimization. On-Page SEO means more now than ever since the new Google update: Panda. No longer are backlinks and simply pinging or sending out a RSS feed the key to getting Google PageRank or Alexa Rankings, You now NEED On-Page SEO. So what is good On-Page SEO?First your keyword must appear in the title.Then it must appear in the URL.You have to optimize your keyword and make sure that it has a nice keyword density of 3-5% in your article with relevant LSI (Latent Semantic Indexing). Then you should spread all H1,H2,H3 tags in your article.Your Keyword should appear in your first paragraph and in the last sentence of the page. You should have relevant usage of Bold and italics of your keyword.There should be one internal link to a page on your blog and you should have one image with an alt tag that has your keyword....wait there's even more Now what if i told you there was a simple Wordpress plugin that does all the On-Page SEO, and automatically for you? That's right AUTOMATICALLY, just watch this 4minute video for more information at. <a href="http://www.SeoOptimizedRankings.com">Seo Plugin</a>
seo http://www.SeoOptimizedRankings.com/


2016-04-30



This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.