list=[i for i in rang(10,30,10)],list[::-1]结果为()
第1题:
针对以下C语言程序,请按要求回答问题。
已知link. c源程序如下:
/*link. c程序对单向链表进行操作,首先建立一个单向链表,然后根据用户的选择可以对其进行插入结点、删除结点和链表反转操作*/
include<stdio. h>
include<stdlib. h>
typedef struct list_node * list_pointer; //定义链表指针
typedef struct list_node{ //定义链表结构
int data;
list_pointer link;
}list_node;
//用到的操作函数
list_pointer create(); //建立一个单向链表
void insert(list_pointer * p_ptr,list_pointer node); //在node后加入一个新的结点
void delete_node(list_pointer * p_ptr,list_pointer trail,list_pointer node);
//删除前一个结点是trail的当前结点node
void print(list_pointer * p_ptr); //打印链表结点中的值
list_pointer invert(list_pointer lead); //反转链表
int main()
{
list_pointer ptr=NULL;
list_pointer node,trail;
list_pointer * P=&ptr;
int choose,location,i;
printf("you should create a link first:\n");
//建立一个单向链表
prt=create(); //ptr指向链表的第一个结点
print(ptr);
//根据用户的不同选择进行相应的操作:
printf("input number 0,you can quit the program\n");
printf("input number 1,you can insert a new node to link\n"):
printf("input number 2,you can delete a node from the link\n");
printf("input number 3,you can invert the link\n"):
printf("please input you choice\n");
scanf("%d",&choose);
while(choose!=0){
switch(choose){
case 1:
i=1:
while(i<location){
node=node->link;
i++:
}
insert(p,node); //p为指向ptr的指针
print(ptr);
break;
case 2:
printf("you will delete a node from the link\n");
printf("please input the location of the node:\n");
scanf("%d",&location):
node=ptr;
if(location==1)
trail=NULL;
trail=ptr;
i=1:
while(i<location){
trail=trail->link:
i++:
}
node=trail->link;
delete_node(p,trail,node);
print(ptr);
break;
case 3:
printf("you will invert the link\n");
ptr=invert(ptr);
print(ptr);
break;
default;
break;
return -1;
}
printf("please input you choice\n");
scanf("%d". &choose):
}
return 0;
//根据用户的输入值建立一个新的单向链表:
list_pointer create()
{
int i,current,length;
list_pointer p1,p2,head;
printf("please input the node number of the link:\n");
scanf("%d". &length):
printf("the number of the link is:%d",length);
printf("please input the data for the link node:\n");
i=0;
p1=p2=(list_pointer)malloc(sizeof(list_node));
head=p1;
for(i=1;i<length;i++){
scanf("%d",&current);
p1->data=current;
p2->link=p1;
p2=p1;
p1=(list_pointer)malloc(sizeof(list_node));
}
p2->link=NULL;
return head;
}
画出主函数main的控制流程图。
第2题:
在窗体上画一个名称为Lisu的列表框,为了对列表框中的每个项目都能进行处理,应使用的循环语句为 ______。
A.For i = 0 To List1. ListCount-1 Next
B.For i = 0 To List1.Count-1 Next
C.For i = 0 To List1. ListCount Next
D.For i = 0 To List1. Count Next
第3题:
在窗体上画一个名称为List1的列表框,为了对列表框中的每个项目都能进行处理,应使用的循环语句为A.For i=0 To List1.ListCount?1 ... NextB.For i=0 To List1.Count?1 ... NextC.For i=1 To List1.ListCount ... NextD.For i=1 To List1.Count ... Next
第4题:
在窗体上画一个名称为List1的列表框,为了对列表框中的每个项目都能进行处理,应使用的循环语句为:
A.For i=0 To List1.ListCount-1 …… Next
B.For i=0 To List1.Count-1 …… Next
C.For i=0 To List1.ListCount …… Next
D.For i=0 To List1.Count …… Next
第5题:
窗体上有一个名为List1的列表框,程序执行时在窗体上单击,输出的结果是( )。 Priate Sub Form_Click() For i=0 To List1.ListCount-1 If i Mod 2=0 Then Print List1.List(i); End If Next i End Sub Private Sub Form_Load() List1.AddItem"中国" List1.AddItem"日本" List1.AddItem"韩国" List1.AddItem"新加坡" List1.AddItem"香港" End Sub
A.中国韩国
B.日本新加坡
C.中国韩国香港
D.中国日本韩国新加坡香港
第6题:
在窗体上有一个名称为List1列表框和一个名称为Command1的按钮,List1的MultiSelect属性设置为2。当单击Command1按钮时,将会把所有选中的选项全部删除。下列程序缺少的一句是______。Private Sub Command1_ Click () for i = List1. ListCount- 1 To 0 Step- 1 if ______ = True then List1. RemoveItem i End if Next iEnd Sub
A.List1.Select(i)
B.List1.Sort(i)
C.List1.List(i)
D.Ltst1.Select(List1.Listindex)
第7题:
往窗体Form1上励口—个列表框控件List1,并编写如下代码: Private Sub Form_Load() For i=0 To 6 List1.AddItem i Next i End Sub 为了在程序运行时,按住Ctrl键单击列表中的项目可以选中多个项目,可以设置List1的属性 ______。
A.List1.List
B.List1.ListIndex
C.List1.MultiSelect
D.List1.Text
第8题:
A.for(Objecto;list)
B.for(Objecto:getCollection()
C.for(Objecto:list.iterator()
D.for(lteratori;list.iterator();i.hasNext())
E.for(lteratori=list.iterator();i.hasNext();)
第9题:
在窗体上画一个列表框、一个文本框及一个按钮,然后编写如下两个事件过程: Private Sub Form_Load() For i=1 To 10 List1.AddItem i * 10 Next i Text1.Text=" " End Sub Private Sub List1_Click() Print List1.Text + Text1.Text End Sub 程序运行后,在文本框中输入“123”,然后双击列表框中的第四行,则在窗体上输出的结果为
A.40123
B.163
C.123
D.30123
第10题:
往窗体Form1上添加一个列表框控件List1,并编写如下代码: Private Sub Form_Load() For i=0 To 6 List1.AddItem i Next i End Sub 为了在程序运行时,按住Ctrl键单击列表中的项目可以选中多个项目,可以设置List1的属性______。
A.List1. List
B.List1. ListIndex
C.List1. MultiSelect
D.List1. Text