[Reprint] The question of the Tencent Company-C + + pen

Source: Internet
Author: User
Tags tree serialization
Tencent Company-C + + pen Test
This part of the Tencent C + + interview with the pen test is mainly C/s + +, DataStructure SimpleAlgorithm Operating Systemand other aspects of the basic knowledge, convenient to Tencent interview development colleagues have reference!

The written questions seem to have sizeof, trees and other multiple-choice questions.

Filling in the blanks is a complete procedure.

The supplementary question has the writing algorithm, Programming, database SQL statement query.

There is also an open problem with C + +.

Tencent/C + + pen questions are as follows:

1, please define a macro, compare the size of the two number A, B, you can not use greater than, less than, if statement

#define MAX (A,B) (A/b)? a:b

2. How to output the header of the source file and the number of rows currently executing

int line = __line__;

char *file = __file__;

cout<< "file name is" << (file) << ", Line is" <

3, two numbers multiplied, the number of digits after the decimal point is not limited, please write a high-precision algorithm

4. Write a virus

while (1)

{

int *p = new int[10000000];

}

5, do not use extra space, will be a, b two linked list of elements of * merge

6, the tree serialization to exist in the array or list

struct st{

int i;

Short S;

char c;

};

sizeof (struct ST);

7,

char * p1;

void * P2;

int p3;

Char p4[10];

sizeof (P1...P4) =?

8,

4,4,4,10

Two-point Search

Quick Sort

Delete node of bidirectional linked list

--------------------------------------------------------------------------------

Interview is basically related to the project, and on the spot to say a few program problems output, can not use draft paper
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.