【单选题】根据下面的定义,能打印出字母 M 的语句是 struct person {char name[9]; int age; }; struct person class[10]={"John",17, "Paul",19, "Mary",18, "adam",16 };
A.printf("%cn",class[3].name);
B.printf("%cn",class[3].name[1]);
C.printf("%cn",class[2].name[1]);
D.printf("%cn",class[2].name[0]);
第1题:
A.printf(“%c\n”,class[3].name);
B.printf(“%c\n”,class[3].name[1]);
C.printf(“%c\n”,class[2].name[1]);
D.printf(“%c\n”,clsaa[2].name[0]);
第2题:
有以下程序:
include <iostream>
include <string>
using nameSpace std;
class person
{
int age;
Char * name;
public:
person ( int i, Char * str )
{
int j;
j = strlen( str ) + 1;
name = new char[ j ];
strcpy( name, str );
age = i;
}
~person()
{
delete name;
cout<<"D";
}
void display()
{
cout<<name<<":"<<age;
}
};
int main()
{
person demo( 30,"Smith" );
demo.display();
return 0;
}
则该程序的输出结果为:【 】。
第3题:
给出下列的不完整的类代码,则下列的( )语句可以加到横线处。 class Person{ String name,department; int age public Person(String n){name=n;} public Person(String n,int a){name=n;age=a;} pubilc Person(String n,String d,int a) { _______________ department=d; } }
A.Person(n,a);
B.this(Person(n,a));
C.this(n,a);
D.this(name,age);
第4题:
根据下面的定义,能打印出字母M的语句是( )。 struct person { char name[9]; int age; }; struct person class[10]={"John",17,"Paul",19,"Mary",18,"Adam",16};
A.printf("%c\n",class[3].name};
B.printf("%c\n",class[2].name[0]);
C.printf("%c\n",class[3].name[1]);
D.printf("%c\n",class[2].name[1]);
第5题:
设有定义:
struct person
{int ID;char name[12];}P;
请将scanf(“%d”, 【 】);语句补充完整,使其能够为结构体变量P的成员ID正确读人数据。
第6题:
定义下列结构体(联合)数组: struct St { char name[15]; int age; }a[10]={"ZHAO",14,"WANG",15,"LIU",16,"ZHANG",17}; 执行语句printf("%d,%c",a[2].age,*(a[3].name+2))的输出结果为( )。
A.15,A
B.16,H
C.16,A
D.17,H
第7题:
若有如下定义: struct stu{char name[9];int age;float score;); struct stu class[10]={{"Li",17,67},{"Song",19,80}, {"guo",18,79},{"Zhao",16,69}}; 根据上面的定义,若执行“printf("%s:%d%f",class[3].name,class[3].age,class[3].score);"则输出的正确结果是( )。
A.Song:19,80.000000
B.Zhao:16,69.000000
C.Li:17,67Song;19,80
D.guo:18,79Zhao;16,69
第8题:
有以下程序: #include<<stdio.h> struct stu { int num; char name[10]: int age;} void fun(struct stu*p) {printf("%s\n",(*p).name);} the main { struct stu students[3]={{9801,"Zhang".20}, {9802,"Wang",19},{9803,"Zhao",1 8}} fun(students+2); } 输出的结果是( )。
A. Zhang
B.Zhao
C.Wang
D.18
第9题:
某C语言结构体的定义如下。 struct date { int year, month, day; }; struct worklist { char name[20]; char sex; struct date birthday; }person; 若对变量person的出生年份进行赋值,正确的赋值语句是(33)。
A.year=1976
B.birthday. year=1976
C.person. year=1976
D.person. birthday. year=1976
第10题:
下列关于结构型变量的定义语句中,错误的是( )
A.typedef struct CCC
B.define GGG struct { char name[20];GGG CCC { char name[20]; int age; int age; }GGG; }; GGG abc ; GGG CCC abc;
C.struct
D.struct { char name[20]; { char name[20]; int age; int age; }ccc; }abc; CCC abc;
第11题:
数据结构里,struct student { char name[20]; char sex[10]; int age; int score; }; 定义结构体后,定义变量、数组赋值正确的是()。
第12题:
Wang:19
Wang:17
Li:20
Li:19
第13题:
给出下列的不完整的类代码,则哪个语句可以被加到横线处? ( ) class Person{ String name,department; int age; public Person(String n){name=n;} public Person(String n,int s){name=n; age=a;} public Person(String n,String d,int a){ department=d;______ } }
A.Person(n,a);
B.this(Person(n,a));
C.this(n,s);
D.this(name,age);
第14题:
有如下定义: struct person{char name[9];int age;}; struct person class[10]={"Johu",17,"Paul",19,"Mary",18,"Adam",16,};根据上述定义,能输出字母M的语句是______。
A.printf("%c\n",class[3].name);
B.printf("%c\n",class[3].name[1]);
C.printf("%c\n",class[2].name[1]);
D.printf("%c\n",class[2].name[O]);
第15题:
有如下定义: struct person {char name[9];int age;} struct person class[10]={ "John",17, "Paul",19, "Mary",18, "Adam",16}; 能输出字母M的是( )
A.printf("%c\n",class[3].name);
B.printf("%c\n",class[3].name[1]);
C.printf("%c\n",class[2].name[1]);
D.printf("%c\n",class[2].name[0]);
第16题:
设有以下语句: struct SS { int no; char name[10];}PERSON; 则下面叙述中错误的是 ( )
A.struct是结构体类型的关键字
B.struct SS是结构体类型
C.PERSON是结构体类型名
D.name是结构体成员名
第17题:
根据下列的定义,能打印出字母P的语句是( )。 struct stu { char name[10]; iht age; }; struct stu s[10]={"John",11, "Paul", 12, "Mary", 11, "adam",12 };
A.printf("%c",s[3].name);
B.printf("%c",s[3].name[1]);
C.printf("%c",s[2].name[1]);
D.printf("%c",s[1].name[0]);
第18题:
定义下列结构体(联合)数组: struct st { char name[15]; int age; }a[10]={"ZHA0",14,"WANG",15,"LIU",16," ZHANG",17); 执行语句printf("%d,%C",a[2].age,*(a[3].name+ 2))的输出结果为( )。
A.15,A
B.16,H
C.16,A
D.17,H
第19题:
定义下列结构体(联合)数组:
struct st
{ char name[15];
int age;
}a[10]={"ZHA0",14,"WANG",15,"LIU",16," ZHANG",17);
执行语句printf("%d,%C",a[2].age,*(a[3].name+ 2))的输出结果为( )。
A.A.15,A
B.16,H
C.16,A
D.17,H
第20题:
以下程序的输出结果是______。#include<stdio.h>struct stu{ int num; char name[10]; int age;};void fun(struct stu*p){ printf("%s\n",(*p).name);}main(){ struct stu students[3]={ {9801,"Zhang",20}, { 9802,"Wang",19}, { 9803,"Zhao",18} }; fun(students+2);}
A.Zhang
B.Zhao
C.Wang
D.18
第21题:
A、prinft("%c\n",class[3].nane);
B、pfintf("%c\n",class[3].name[1]);
C、prinft("%c\n",class[2].name[1]);
D、printf("%c\n",class[2].name[0])
第22题:
根据下列的定义,能打印出字母P的语句是( )。 struct stu {char name[10]; int age; }; struct sm s[10]={"John",11, "Pau1",12, "Mary",11, "adam",12 };
A.printf("%c",s[3].name);
B.printf("%c",s[3].name[1]);
C.printf("%c",s[2].name[1]);
D.printf("%c",s[1].name[0]);
第23题:
Zhang
Zhao
Wang
19
第24题:
Li:19
Wang:19
Li:20
Wang:17