• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            李帥的博客

            軟件開(kāi)發(fā)愛(ài)好者

              C++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              14 隨筆 :: 3 文章 :: 4 評(píng)論 :: 0 Trackbacks
            9. Which of the following statements provide a valid reason NOT to use RTTI for distributed (i.e. networked between different platforms) applications in C++?
            A. RTTI is too slow.
            B. RTTI does not have standardized run-time behavior.
            C. RTTI uses too much memory.
            D. RTTI's performance is unpredictable/non-deterministic.
            E. RTTI frequently fails to function correctly at run-time

            11. A C++ developer wants to handle a static_cast <char*>() operation for the class String shown below. Which of the following options are valid declarations that will accomplish this task?
            class String {
            public:
              //...
              //declaration goes here
            };
            A. char* operator char*();
            B. operator char*();
            C. char* operator();
            D. String operator char*();
            E. char* operator String();


            16. When a Copy Constructor is not written for a class, the C++ compiler generates one. Which of the following statements correctly describe the actions of this compiler-generated Copy Constructor when invoked?
            A. The compiler-generated Copy Constructor makes the object being constructed, a reference to the object passed to it as an argument.
            B. The compiler-generated Copy Constructor does not do anything by default.
            C. The compiler-generated Copy Constructor performs a member-wise copy of the object passed to it as an argument, into the object being constructed.
            D. The compiler-generated Copy Constructor tags the object as having been Copy-Constructed by the compiler.
            E. The compiler-generated Copy Constructor invokes the assignment operator of the class.

            17. Which of the following must be ensured in order to implement a polymorphic function in C++?
            A.        There has to be a pointer of the derived class that has implemented the polymorphic function that holds the address of the derived class object.
            B.        The function must be declared as virtual in both the base class and in the derived class that overrides the function.
            C.        The function must be declared as pure virtual.
            D.        There has to be a base class pointer holding the address of a base or derived class object that has implemented the polymorphic function.
            E.        The function must be declared as virtual in the base class.

            18. Protected, or private, inheritance, as opposed to public inheritance, models which type of relationship in C++?
            A.        Can-only-have-one-of
            B.        Is-implemented-in-terms-of
            C.        Was-a
            D.        Has-a
            E.        Shares-a-relationship-with

            19. Which of the following statements describe correct methods of handling C++ exceptions?
            A.        Once an exception is thrown, the compiler unwinds the heap, freeing any memory dynamically allocated within the block from which the exception was thrown.
            B.        In a hierarchy of exception classes, the order of handling exceptions can be from the most specific class to the most general class.
            C.        Catching an exception by reference is preferable to catching it by value.
            D.        If an exception is caught by its address or pointer, it is the responsibility of the thrower to release the memory occupied by the exception.
            E.        To write an exception handler, it is essential to know the concrete class of exception to catch.

            20. Which of the following statements regarding functions' default arguments in C++ are correct?
            A.        Default arguments cannot be of a user-defined type.
            B.        Default arguments exist in the global heap and not on the function's stack.
            C.        Default arguments cannot be of pointer type.
            D.        Default arguments can never precede non-default arguments.
            E.        Default arguments are not considered for generating the function's signature.

            21. Which of the following classes must be instantiated so that the object can be used both for reading and writing to the same file in C++?
            A.        ofstream
            B.        stream
            C.        ifstream
            D.        fstream
            E.        iostream

            22.  Which of the following reasons describe why a destructor cannot throw an exception in C++?
            A.        Since the object is being destroyed, it is illogical to throw an exception then.
            B.        A destructor may be invoked as a result of stack unwinding while an exception is being handled.
            C.        It can invoke the terminate() handler.
            D.        The C++ language does not permit it; a throw statement in a destructor will be caught as an error by the compiler.
            E.        A destructor in C++ cannot implement a try...catch block

            24. Which of the following identify const-correctness failures in the C++ program below?
            template<typename T>
            class MyArray
            {
            public:
                MyArray();
                MyArray(MyArray& copy);
                MyArray& operator=(MyArray& copy);
                //...

            };

            class MyData
            {
            public:
                MyData(MyArray<int>& x, MyArray<int>& y);
                //...

                const MyArray<int>& x();
                const MyArray<int>& y();
            };

            MyArray<int> read_data(int*, char**);
            void make_changes(MyData* edit);

            int main(int argc, char* argv[])
            {
                const MyArray<int> read_x = read_data(&argc, argv);
                const MyArray<int> read_y = read_data(&argc, argv);
                 
                MyData user_data(read_x, read_y);
                MyData edit_buffer(user_data);
                make_changes(&edit_buffer);
            }

            A.        MyData(MyArray<int>& x, MyArray<int>& y); should be
            MyData(const MyArray<int>& x, const MyArray<int>& y);

            B.        MyArray(MyArray& copy); should be
            MyArray(const MyArray& copy);

            C.        MyArray& operator=(MyArray& copy); should be
            const MyArray& operator=(const MyArray& copy);

            D.        void make_changes(MyData* edit); should be
            void make_changes(const MyData* edit);

            E.        const MyArray& operator=(const MyArray& copy); should be
            const MyArray& operator=(const MyArray& copy) const;

            25. Which of the following operators must be overloaded by function objects in the Standard Template Library?
            A.        operator +()
            B.        operator ==()
            C.        operator ++()
            D.        operator ()()
            E.        operator []()

            ======================================================

            附上我的選擇和疑問(wèn),歡迎大家指正和討論:

            9. AD (not quite sure)
            11. A (What does this question mean?! Can anyone explain it? )
            16. AC  (Is A right?! Should it be 'a CONST reference to the object passed to it as an argument')
            17. E (not quite sure. Is A or D right too? )
            18. A or E. I have no idea at all!!!!
            19 C (Is B right too?)
            20. only D?
            21. DE
            22. BC ?
            24. only B ?
            25. D
            posted on 2008-11-07 21:37 李帥 閱讀(1353) 評(píng)論(1)  編輯 收藏 引用

            評(píng)論

            # re: 幾道C++筆試題,不定項(xiàng)選擇,請(qǐng)高手解答分析,歡迎討論。 2011-09-21 17:55 臭美街
            [url=http://www.choumeijie.com/]臭美街[/url]  回復(fù)  更多評(píng)論
              


            只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


            亚洲精品蜜桃久久久久久| 97久久超碰国产精品2021| 国产成人精品白浆久久69| 国产V综合V亚洲欧美久久| 日日噜噜夜夜狠狠久久丁香五月 | 国产精品久久久久久久人人看| 无码任你躁久久久久久| 久久久这里有精品| 无码人妻久久一区二区三区免费| 久久夜色tv网站| 久久精品aⅴ无码中文字字幕不卡| 久久久久久久97| 女同久久| 久久青草国产精品一区| 一本久久免费视频| 青青热久久综合网伊人| 亚洲国产成人久久综合野外| 久久久久亚洲av无码专区导航 | 一本色道久久99一综合| 国产精品VIDEOSSEX久久发布| 中文字幕日本人妻久久久免费| 久久国产精品无码HDAV | 精品久久亚洲中文无码| 亚洲国产成人久久综合碰碰动漫3d| 国产精品久久久久久久人人看| 国产精品久久午夜夜伦鲁鲁| AV无码久久久久不卡蜜桃| 国产精品久久久久久影院| 97久久国产综合精品女不卡| 热RE99久久精品国产66热| 国产叼嘿久久精品久久| 久久99精品国产| 精品人妻久久久久久888| 亚洲人成伊人成综合网久久久| 无码精品久久一区二区三区| 亚洲а∨天堂久久精品| 久久免费视频一区| 久久久久成人精品无码| 国产精品成人99久久久久 | 午夜精品久久影院蜜桃| 婷婷久久综合|