包含vb.net考试题目的词条

VB.NET的题目哈 随机产生20个大写字母,求出现次数最多的字母及出现次数,还有求出现次数为0的字母有哪些

Imports System.Text.RegularExpressions

成都创新互联公司专注于金秀网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供金秀营销型网站建设,金秀网站制作、金秀网页设计、金秀网站官网定制、微信小程序服务,打造金秀网络公司原创品牌,更为您提供金秀网站排名全网营销落地服务。

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim a As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

Dim g() As Char = a.ToCharArray

Dim MyRandom As New Random

Dim bs As String = ""

For i = 1 To 20

bs = g(MyRandom.Next(0, g.GetUpperBound(0) + 1))

Next

Dim gs() As String = (From mt As Match In Regex.Matches(bs, "[A-Z]") Select mt.Value).ToArray

System.Array.Sort(gs)

gs = (From mt As Match In Regex.Matches(Join(gs, ""), "([A-Z])\1*") Select mt.Value).ToArray

Dim g_len() As Integer

g_len = (From mt As Match In Regex.Matches(Join(gs, ""), "([A-Z])\1*") Select mt.Length).ToArray ' 使用数组元素作为计数器g_len

System.Array.Sort(g_len, gs)

Label1.Text = "出现次数最多的字母:" gs(gs.GetUpperBound(0)).Substring(0, 1) " 共出现" g_len(g_len.GetUpperBound(0)) "次" vbCrLf "没有出现的字母是:" Join(a.Split(bs.ToCharArray), "")

End Sub

End Class

还有两道vb.net面试题,请大家帮忙,谢谢。

我很喜欢这种题目

-------------------------------------------------------------------------

第7题,问题出在两方面

Public Function CalculateArea(ByVal SideBase As Double, ByVal Height As Double, _ Optional

ByVal AssignToArea As Boolean = False) As Double

Dim Area As Double = (SideBase * Height) / 2

中间的 _ 有问题,应该去掉

还有objShape = CType(objShape, clsTriangle) 有错误,不能转换

注释掉objShape = CType(objShape, clsTriangle)

删除_后,得到结果

true

false

-330

--------------------------------------------------------------------------

第8题,就是以acc_grp_cust_tbl表为基础,查找cust_tbl并输出

一般的话使用涉及两个表的话使用SHAPE语句(以SQL为基础的语句)

虽然两者使用时差不多,但是理论比较难懂,我这里也不讲了,我使用ADO+SQL方法

先说明一下程序中的一个细节,也是问题比较容易忽略的

1400 0 1 2

1500 3 4

1600 5

说明一个问题Cust_id1 Cust_id2 Cust_id3 Cust_id4 字段不是数值,而是类似字符的东西(因为可能是

备注)

定义rsgrp对应acc_grp_cust_tbl ,rscust对应cust_tbl

预先设置好rsgrp和rscust的连接(使用VB的方法,可以移植到VB.NET上)

do until rscust.eof

strline=rscust(0) " "

strSQL="SELECT * FROM CUST_TBL WHERE cust_id='" RSGRP(1) "' OR CUST_ID='" RSGRP(2) "' OR CUST_ID='" RSGRP(3) "' OR CUST_ID='" RSGRP(4) "'"

RSGRP.OPEN STRSQL

if rsgrp.recordcount0 then

rsgrp.movefirst

do until rsgrp.eof

strLine=strline rscust(3) " " rscust(2) "/"

rsgrp.movenext

loop

end if

rscust.close

strline=left(strline ,len(strline)-1)

'去除最后一个"/"

console.writeline(strline)

loop

vb.net面试题,请大家帮忙,谢谢。

如果需要讲详细一点,那就加我QQ531412815

第4题,潜在的错误,这里的错误不是常规错误,属于那种只有在运行是才知道的错误:

Catch ex As Exception

MsgBox(ex.StackTrace)

'永远不会查找下面的错误

Catch ex As ArgumentNullException

MsgBox("Input Test box cannot be null.")

Catch ex As OverflowException

MsgBox("Input Test box 2 cannot be zero!")

Catch ex As FormatException

MsgBox("Input Test box should be numeric format!")

结构化错误处理永远达不到下面这里,因为Catch ex As Exception 已经处理了所有错误.

第5题:

00123

1000 60.50

2000 60.00

3500 59.50

---- -----

6500 60.00

00124

3000 60.50

---- -----

3000 60.50

00125

2000 59.50

1000 58.00

---- -----

3000 58.75

就是按照Ref_ID 分类,有一种方法就是按照Ref_ID 分组,也就是使用SQL语言,不过这里需要该很多,

我就不用了,那么就稍微复杂一点,使用FIND方法,不过有一点必须注意REF_ID必须排序,因为数据库中

已经排好序了,我就不用排了。

Dim rst as ADODB.Recordset

dim refID as string

Rst = GetRecordset

Do While Not rst.EOF

refid=rst(0)

Console.writeline(rst.Fields("Ref_ID")

do

Console.writeline rst.Fields("Qty") vbcrlf rst.Fields("Price"))

rst.MoveNext()

loop while rst(0)=refid

Loop

第6题:就是从一个集合中取元素输出的问题

比较简单的办法就是使用递归

以下是使用VB的方法(可以移植到VB.NET上,因为我对VB.NET的数组到现在还不太会,所以就将就一下)

Dim bUse() As Boolean

Dim lStr() As String * 1

Dim nCount As Byte

-----------------------------------------------------------------------------------

Public Sub Combination(lstStr As String)

Dim i As Byte

Dim j As Byte

Dim StrLen As Byte

StrLen = Len(lstStr)

ReDim bUse(1 To StrLen) As Boolean

ReDim lStr(1 To StrLen) As String * 1

For i = 1 To StrLen

lStr(i) = Mid(lstStr, i, 1)

Next

For i = 1 To StrLen

nCount = i

GoWith StrLen, 1, 0, ""

Next

End Sub

------------------------------------------------------------------------------------

Public Sub GoWith(ECount As Byte, nStart As Byte, Deep As Byte, lastStr As String)

Dim i As Byte

If Deep = nCount Then

Debug.Print lastStr

Exit Sub

End If

For i = nStart To ECount

If Not bUse(i) Then

bUse(i) = True

GoWith ECount, i, Deep + 1, lastStr lStr(i)

bUse(i) = False

End If

Next

End Sub

--------------------------------------------------------------------------------------

Private Sub Form_Load()

Combination "wxyz"

End Sub

--------------------------------------------------------------------------------------

其中GOWITH是真正的递归函数,而Combination是用来预处理字符的

全局变量:

BUSE:用来确定是否使用过这个元素

lSTR:用来保存字符元素

NCOUNT:用来限制递归函数的深度,换句话说,就是输出元素组中的元素个数

实际测试成功,另外我对前三题很感兴趣,希望能够传给我

这道题能解释一下吗?

可以,

假设除以4的商为a余数为j,初一3的商为b余数为k

那么可得

n=4a+j

n=3b+k

可以换算成

3n=12a+3j

4n=12b+4k

两式相减得

n=12b+4k-12a-3j

n=12(b-a)+(4k-3j)

即能除以12余4k-3j,所以除以6必定也余4k-3j,如果算出来是负数或者大于6,取正值或者再除以6即可


当前标题:包含vb.net考试题目的词条
网站网址:http://bzwzjz.com/article/doipgcd.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 成都品牌网站设计 企业网站建设公司 成都网站建设 成都响应式网站建设公司 成都定制网站建设 网站制作公司 高端网站设计 成都网站设计公司 网站设计 网站设计 网站建设开发 专业网站设计 成都品牌网站建设 定制网站建设多少钱 网站建设公司 营销型网站建设 成都企业网站建设公司 成都定制网站建设 重庆网站建设 成都网站建设 手机网站制作 重庆手机网站建设