What does the following function return?char foo(void){unsigned int a = 6;iht b = -20;char c;(a+b 6) ? (c=1): (c=0);return c;}

What does the following function return?

char foo(void)

{

unsigned int a = 6;

iht b = -20;

char c;

(a+b > 6) ? (c=1): (c=0);

return c;

}


相关考题:

class A{public int getNumber(int a){return a+1;}}class B extends A{public int getNumber(int a, char c){return a+2;}public static void main(String[] args){B b=new B();System.out.println(b.getNumber(0));}}what is the result?()A.compilation succeeds and 1 is printedB.compilation succeeds and 2 is printedC.compilation succeeds and 3 is printedD.An error at this program cause compilation to fail

以下与库函数strcmp(char *s, chat *t)的功能相等的程序段是()。 A.strcmp1(char *s, chat *t){ for ( ;*s++==*t++ ;)if (*s=='\0') return 0return (*s-*t)}B.strcmp2(char *s, char *t){ for( ;*s++==*t++ ;)if (!*s) return0return (*s-*t)C.strcmp3(char *s, char *t){ for ( ;*t==*s ;){ if (!*t) return 0t++s++}return (*s-*t)}D.strcmp4(char *s, char *t){ for( ;*s==*t;s++,t++)if (!*s) return 0return (*t-*s)}

阅读下面程序段,则执行后输出的结果是#include "stdio.h"main(){ char fun(char,int);char a=′A′;int b=13;a=fun(a,b);putchar(a);}char fun(char a,int b){char k;k=a+b;return k;}A.AB.MC.ND.L

若下面程序运行时输出结果为1, A, 10.12, B, 3.5请将程序补充完整 。#includeusing namespace std;int main(){void test(int, char,double 【 8 】 );test(1,'A',10.1);test(2,'B');return 0;}void test(int a, char b, doubleC .{cout}

有如下程序: include using namespaee std;class Animal{ public: virtual char*g 有如下程序:include<iostream>using namespaee std;c lass Animal{public:virtual char*getType( )const{return"Animal";}virtual char*getVoice( )const{return"Voice";}};class Dog:public Animal{public:char*getType( )const{return"Dog";}char*getVoice( )eonst{return"Woof";}};void type(AnimalA) {cout<<a.getType( );}void speak(Animal A) {eout<<a.getVoice( );}int main( ){Dog d;type(D) ;cout<<"speak";speak(D) ;cout return 0;}程序的输出结果是______。

[说明1]函数void convelt(chal *a,int n)是用递归方法将一个正整数n按逆序存放到一个字符数组a中,例如,n=123,在a中的存放为'3'、'2'、'1'。[C函数1]void convert(char *a,int n){ int i;if((i=n/10)!=0; convert( (1) ,i);*a= (2) ;}[说明2]函数int index(char *s,char *t)检查字符串s中是否包含字符串t,若包含,则返回t在s中的开始位置(下标值),否则返回-1。[C函数2]int index(char *s,char *t){ int i,j=0;k=0;for(i=0;s[i]!:'\0';i++)( for( (3) ;(t[k]!='\0')(s[j]!='\0')( (4) );j++,k++);if( (5) ) return(i);}return(-1);}

( 27 )有如下程序:#includeiostream#includecstringusing namespace std;class XCD{char* a;int b;public:XCD ( char* aa, int bb ) {a=new char[strlen ( aa ) +1];strcpty ( a,aa ) ;b=bb;}Char* Geta () {return a; )int Getb () { return b;}};int main () {char *pl="abcd" , *p2="weirong" ;int dl=6, d2=8;XCD x ( pl,dl ) , Y ( p2 , d2 ) ;coutstrien ( x .Geta ( ) ) +y. Getb () +endl;return 0;}运行时的输出结果是A ) 12B ) 16C ) 14D ) 11

( 12 )有如下程序:#include iostreamusing namespace stdclass Animal{public:virtual char* getType () const { return "Animal" ; }virtual char* getVoice () const { return "Voice" ; }};Class Dog : public Animal {public:char* getType ( ) const {return "Dog" ; }char* getVoice ( ) const {return "Woof"}};void type ( Animal a ) {couta.getType ( ) ; }void speak ( Animal a ) {couta.getVoice ( ) ; }int main ( ) {Dog d; type ( d ) ; cout" speak" ; speak ( d ) ; coutendi;return 0;}运行时的输出结果是【 12 】 。

若下面程序运行时输出结果为1,A,10.1 2,B,3.5 include using namespace std; int mai 若下面程序运行时输出结果为1,A,10.12,B,3.5include <iostream>using namespace std;int main(){void test(int, char, doubie【 】);test(1, 'A', 10.1 );test(2, 'B');return 0;}void test(int a, char b, double c){cout<<a<<','<<b<<','<<c<<endl;}

有以下程序 include int fun(char s[]) { int n=O; whil 有以下程序 #include <stdio.h> int fun(char s[]) { int n=O; while(*s<='9'*s>='0') { n=10*n+*s-'0'; s++; } return (n); } main() { char s[10]={ '6', '1', '*', '4', '*', '9', '*', '0', '*'}; printf("%d\n",fun(s)); }A.9B.61490C.61D.5

有以下程序include include using namespace std;class base{private:char 有以下程序 #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base () { strcpy(baseName,"Base"); } virtual char *myName() { return baseName; } char *className() { return baseName; } }; class Derived : public base { private: char derivedName[10]; public: Derived() { strcpy(derivedName,"Derived"); } char *myName() { return derivedName; } char *className() { return derivedName; } }; void showPtr(base p) { cout<<p.myName () <<" "<<p.className (); } int main () { base bb; Derived dd; showPtr(dd); return 0; } 运行后的输出结果为A.Derived BaseB.Base BaseC.Derived DerivedD.Base Derived

有如下程序:ncludeiostreamusing namespace std;class Animal{public:virtual char*getType()const{return“Animal”;}virtual char*getVoice()const{return“Voice”;}};class Dog:public Animal{public:char*getType()const{rgturn“Dog”;}char*getVoice()const{retum“Woof”;}};void type(AnimalA){couta.getType();}void speak(AnimalA){couta.getVoice();}int main(){Dog d.type(D);tout“speak”;speak(D);coutendl;return 0;}运行时的输出结果是【 】

下列程序的输出结果是【】。 include include using namespace std; void fun(c 下列程序的输出结果是【 】。include<iostream>include<cstring>using namespace std;void fun(const char *s,char c){c=s[strlen(s)/2];}int main(){char str[]="ABCDE";char ch=str[1];fun(str,ch);cout<<ch;return 0;}

下列程序的输出结果是______。includeinclude using namespace std;void 下列程序的输出结果是______。include <iostream.h>include <cstring.h>using namespace std;void fun(const char*s,char C) {c=s[strlen (s)/2];}int main {){char str [] ="ABCDE";char ch=str[1];fun(str,sh);cout<<Ch;return 0;}

有如下程序:#includeiostream#includecstringusing namespace std;class XCD{char*a;int b;public:XCD(char;l:aa,int bB){a=flew char[strlen(aA)+1];strcpy(a,aA);b=bb;}char*lE Geta(){return a;}int Getb(){return b;}};int main(){char*pl=”abcd”.*p2=”weirong”;int dl=6,d2=8;XCD x(pl;d1),Y(p2,d2);coutstrlen(X.Gem())+Y.Getb()endl;return 0;}、运行时的输出结果是A.12B.16C.14D.11

以下程序的输出结果是()。includeint fun (char*s){char *p=s;while (*p!='\0,) p++ 以下程序的输出结果是( )。 #include<iostream.h> int fun (char*s) { char *p=s; while (*p!='\0,) p++: return (p-s): } void main() { cout<<fun (" ABCDEF ")<<endl: }A.3B.6C.8D.0

以下程序的执行结果为【】。 include using namespace std; void overload(int num) {cou 以下程序的执行结果为【 】。include<iostream>using namespace std;void overload(int num){cout<<num<<end1;}void overload(char ch){char c=ch+1;cout<<c<<end1;}int main(){overload('X');return 0;}

下面程序输出的结果是()。includeusing namespace std;int fuc (char *x);int main(){ 下面程序输出的结果是( )。 #include<iostream> using namespace std; int fuc (char *x); int main(){ cout<<fuc("hello")<<endl; return 0; } int fuc(char *x){ char *y=x; while(*y! ='\0')y++; return(y-x); }A.5B.6C.0D.语法错误,不能输出结果

如下程序的输出结果是includeincludeusing namespace std;class XCD{char* 如下程序的输出结果是 #include<lostream> #include<cstring> using namespace std; class XCD{ char*a; int b; public: XCD(char*aa,int bB) { a=new char[strlen(aA) +1]; strcpy(a,aA) ; b=bb; } char*Geta( ){return a;} int Getb( ){return b;} }; int main( ){ char*pl="abcd",*p2="weirong": int dl,6,d2=8; XCD x(pl,d1),y(p2,d2); cout<<strlen(x.Geta( ))+y.Getb( )<<endl; return 0; }A.12B.16C.14D.11

在下面程序运行includeint func(char s[]){ int length=0; while(*(s+length))leng 在下面程序运行 #include<iostream.h> int func(char s[]){ int length=0; while(*(s+length))length++; return length; } void main(){ char a[10], *ptr=a; cin>>ptr; cout<<fune(ptr)<<end1; } 如果输入字符串Hello!并回车,则输出结果为 ______。A.4B.7C.6D.5

有以下程序: include void fun(char(*p)[6]) { int i; for(i=0;i 有以下程序: #include void fun(char(*p)[6]) { int i; for(i=0;iA.Aa1FB.Ab3IC.ABCDD.fghij

有以下程序 include int f(iht n) { if(n==1) return 1; else return f(n-1)+ 有以下程序 #include<iostream.h> int f(iht n) { if(n==1) return 1; else return f(n-1)+1;} void main( ) { iht i,j=0; for(i=1;i<3;i++)j+=f(i); cout < < j;} 程序运行后的输出结果是A.4B.3C.2D.1

下列程序的输出结果是______。 include int CalcDigital(char*str) { if(str= =NULL) 下列程序的输出结果是______。include<iostream.h>int CalcDigital(char*str){if(str= =NULL)return 0;int num_of_digital=0;for(int i=0;str{i]!=0x0;i++)if(str[i]<='9' str[i]>='0')num_of_digital++;return num_of_digital;}void main( ){char a[]="Beijing20080lympic";cout<<CalcDigital(a)<<endl;}

阅读以下说明和C语言程序,将应填入(n)处的字句写在对应栏内。【说明】以字符流形式读入一个文件,从文件中检索出6种C语言的关键字,并统计、输出每种关键字在文件中出现的次数。本程序中规定:单词是一个以空格或'\t'、'\n'结束的字符串。其中6种关键字在程序中已经给出。【程序】include <stdio.h>include <stdlib.h>FILE *cp;char fname[20], buf[100];int NUM;struct key{ char word[10];int count;}keyword[]={ "if", 0, "char", 0, "int", 0,"else", 0, "while", 0, "return", 0};char *getword (FILE *fp){ int i=0;char c;while((c=getc(fp))!= EOF (1));if(c==EOF)return (NULL);elsebuf[i++]=c;while((c=fgetc(fp))!=EOF c!=" c!='\t' c!='\n' )buf[i++]=c;buf[i]='\0';return(buf);}void lookup(char *p){ int i;char *q, *s;for(i=0; i<NUM; i++){ q=(2);s=p;while(*s (*s==*q)){ (3))if((4)){ keyword[i].count++;break;}}return;}void main(){ int i;char *word;printf("lnput file name:");scanf("%s", fname);if((cp=fopen(fname, "r"))==NULL){ printf("File open error: %s\n", fname);exit(0);}NUM=sizeof(keyword)/sizeof(struct key);while((5))lookup(word);fclose(cp);for(i=0;i<NUM;i++)printf("keyword:%-20s count=%d\n",keyword[i].word,keyword[i].count);}

10. interface Foo { int bar(); }  11. public class Sprite {  12. public int fubar( Foo foo) { return foo.bar(); }  13. public void testFoo() {  14. fubar(  15. // insert code here  16.);  17. }  18. }  Which code, inserted at line 15, allows the class Sprite to compile?() A、 Foo { public int bar() { return 1; } }B、 new Foo { public int bar() { return 1; } }C、 newFoo() { public int bar(){return 1; } }D、 new class Foo { public int bar() { return 1; } }

public class Delta {  static boolean foo(char c) {  System.out.print(c);  return true;  }  public static void main( String[] argv ) {  int i =0;  for ( foo(‘A’); foo(‘B’)(i2); foo(‘C’)){  i++ ;  foo(‘D’);  }  }  }  What is the result?()  A、 ABDCBDCBB、 ABCDABCDC、 Compilation fails.D、 An exception is thrown at runtime.

单选题public class Delta {  static boolean foo(char c) {  System.out.print(c);  return true;  }  public static void main( String[] argv ) {  int i =0;  for ( foo(‘A’); foo(‘B’)(i2); foo(‘C’)){  i++ ;  foo(‘D’);  }  }  }  What is the result?()A ABDCBDCBB ABCDABCDC Compilation fails.D An exception is thrown at runtime.