Perfect school recruit only three jobs C + +, Java, game planning

Source: Internet
Author: User

The perfect school recruit position only three: C + +, Java, game planning (in short, the basis is very important, and must be proficient in a language)

Question one: Give a hexadecimal number 0xFF 0x80 (only 2 "bit") to convert it to a signed byte decimal integer

Solution: Because it is turned into a signed number, you can first turn it into binary such as: 0xff->1111 1111

The visible sign bit is 1, is negative, negative numbers are stored in the complement, so seek the original code

Complement minus an inverse is the original code 1111 1110->1000 0001--1 Take the inverse of the symbol bit unchanged

0x80 1000 0000 Sign bit 1 is negative for the original code: 0111 1111-1000 0000-128

0x00 0000 0000 Sign bit is 0 complement that original code 0000 0000, 0

0x7F 0111 1111 Sign bit 0 0111 1111->127

0x00~0x79 for 0~127 0x80~0xff to -128~-1 in one-byte numbers

Issue two: 4+6-7 # Implement this expression in code

You can refer to the inverse Polish style in the compilation principle

Divided into data stack d and symbol stack F

The number is encountered in the stack d, encountered the symbol into the stack F

D:3 4 6

f:* (+

The symbol stack is stacked to (

D:3 4 6 +

F: *

Continue into the stack


D:3 4 6 + 7

F: *-

Until you encounter Terminator #, stack the symbol stack
D:3 4 6 + 7-*

At this point the inverse Polish has been established to complete the start operation

Build an OP stack s, D sequence out of the stack and then into the stack s

S:3 4 6

Until the sign + is encountered, S is continuously out of stack 2 times

Calculate 4+6->10 and then put the new data into the stack s

S:3 10

Continue to follow this rule until stack d is empty, and s will eventually have only one number, which is the answer

Question three: There is a set of numbers, giving the Huffman coding requires the average weight to be minimal
For example: 3 7 9 1 12 build Heffman based on its size

Issue four: Virtual inheritance in C + +

1. The role of virtual inheritance

Two semantics of multiple inheritance, etc.

2, to the virtual base class understanding

Question five: single-instance mode

Issue six: Enable an instance of a class to allocate memory only in the heap cannot allocate memory in the stack

Class a{};

A A = new A is allocating memory in the heap

A b; is to allocate memory in the stack to call its default constructor

So declaring its default constructor as private can
In short, the question notes asked are biased.

Perfect school recruit only three jobs C + +, Java, game planning

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.