1. What is the following three output statements? [C easy] char str1 [] = "abc"; char str2 [] = "abc"; const char str3 [] = "abc"; const char str4 [] = "abc"; const char * str5 = "abc" Const char * str6 = "abc"; cout << boolalpha << (str1 == str2) << ENDL; / / output? 0cout << BOOLALPHA << (str3 == STR4) << endl; // What? 0cout << BOOLALPHA << (str5 == str6) << ENDL; / / OR output? 1
-------------------------------------------------- -------------------------------------------------- ------------------------------------------
Non-C built-in types A and B, which case B can implicit into A? [C Medium] Answer: a. Class B: Public a {...} // B Public Inheritance Self A, can be indirect inherited B. Class B {Operator A ();} // b Implementing implicit transformation A Transformation C. Class A {a (const b ";} // A implementing Non-Explicit parameters B (can have other parameters with default) Constructor D. A & Operator = (Const A &); / / Assignment operation, although it is not an authentic implicit type conversion, but it can also be considered one
-------------------------------------------------- -------------------------------------------------- ------------------------------------------
Is there a problem with the two SizeOf usage in the following code? [C Easy] Void Uppercase (CHAR STR []) // converts the lowercase letters in the STR to uppercase letters {for (size_t i = 0; I Because SizeOf (STR) is always equal to 4 after the parameter passed -------------------------------------------------- -------------------------------------------------- ----------------------------------------- The following code is there? [C easy] struct test {test (int) {} test () {} void fun () {}}; void main (void) {test a (1); A.Fun (); test b (); b .fun (); When the default function of the call structure is not () such as: Test A; -------------------------------------------------- -------------------------------------------------- ----------------------------------------- What is the problem with the following code? [C easy] cout << (True? 1: "1") << ENDL; ? The type of two return values behind should be the same -------------------------------------------------- -------------------------------------------------- ------------------------------------------ Unsigned int const size1 = 2; char str1 [size1]; unsigned int temp = 0; cin >> Temp; unsigned int const size2 = temp; char str2 [size2]; The first is right, and the second is wrong. -------------------------------------------------- -------------------------------------------------- ------------------------------------------ Struct CLS {INT M_I; CLS (INT I): m_i (i) {} CLS () {CLS (0);}}; CLS Obj; Cout << Obj.m_i << endl; It is not possible to get the output result of 0, because the call inside the constructor is another object created in memory. -------------------------------------------------- -------------------------------------------------- ------------------------------------------