ÉèΪÊ×Ò³ ¼ÓÈëÊÕ²Ø

TOP

¼¸µÀc±ÊÊÔÌâ(º¬²Î¿¼´ð°¸)
2014-11-24 01:20:10 ¡¾´ó ÖРС¡¿ ä¯ÀÀ:8080´Î
Tags£º¼¸µÀ ÊÔÌ⠲ο¼ ´ð°¸

1.
What is displayed when f() is called given the code:
class Number {
public:
string type;


Number(): type(¡°void¡±) { }
explicit Number(short) : type(¡°short¡±) { }
Number(int) : type(¡°int¡±) { }
};
void Show(const Number& n) { cout << n.type; }
void f()
{
short s = 42;
Show(s);
}
a) void
b) short
c) int
d) None of the above


2. Which is the correct output for the following code
double dArray[2] = {4, 8}, *p, *q;
p = &dArray[0];
q = p + 1;
cout << q ¨C p << endl;
cout << (int)q ¨C (int)p << endl;
a) 1 and 8
b) 8 and 4
c) 4 and 8
d) 8 and 1


µÚÒ»¸öÑ¡C£»
ËäÈ»´«ÈëµÄÊÇshortÀàÐÍ£¬µ«ÊÇshortÀàÐ͵Ĺ¹Ô캯Êý±»ÉúÃü±»explicit£¬Ò²¾ÍÊÇÖ»ÄÜÏÔʾÀàÐÍת»»£¬²»ÄÜʹÓÃÒþʽÀàÐÍת»»¡£
µÚ¶þ¸öÑ¡A£»
µÚÒ»¸öÊÇÖ¸Õë¼Ó¼õ£¬°´ÕÕµÄÊÇÖ¸ÏòµØÖ·ÀàÐ͵ļӼõ£¬Ö»¸úÀàÐÍλÖÃÓйأ¬qºÍpÖ¸ÏòµÄÊý¾ÝÀàÐÍÒÔʵ¼ÊÊý¾ÝÀàÐÍÀ´Ëã²îÒ»¸öλÖã¬Òò´ËÊÇ1¡£¶øµÚ¶þ¸ö¼Ó¼õÊÇʵ¼ÊÖ¸ÕëÖµµÃ¼Ó¼õ£¬ÔÚÄÚ´æÖÐÒ»¸ödoubleÀàÐÍÕ¼¾Ý8¸ö×Ö½Ú£¬Òò´ËÊÇ8


¡¾´ó ÖРС¡¿¡¾´òÓ¡¡¿ ¡¾·±Ìå¡¿¡¾Í¶¸å¡¿¡¾Êղء¿ ¡¾ÍƼö¡¿¡¾¾Ù±¨¡¿¡¾ÆÀÂÛ¡¿ ¡¾¹Ø±Õ¡¿ ¡¾·µ»Ø¶¥²¿¡¿
ÉÏһƪ£ºc/c++ij´ó¹«Ë¾µÄÁ½µÀ±ÊÊÔÌâ(º¬²Î.. ÏÂһƪ£ºCÓïÑÔ¿ª·¢¹¤³Ìʦ²âÊÔÌâ

×îÐÂÎÄÕÂ

ÈÈÃÅÎÄÕÂ

Hot ÎÄÕÂ

Python

C ÓïÑÔ

C++»ù´¡

´óÊý¾Ý»ù´¡

linux±à³Ì»ù´¡

C/C++ÃæÊÔÌâÄ¿