This exam face questions from the public number: undergraduate non-programmers finishing release
Question 1: Description of compiled and interpreted programming language?
Programs written in interpreted languages do not need to compile, in the course of implementation, there is a dedicated interpreter to translate the VB language into machine language, when each statement is executed only translation. Such an interpreted language translation will be performed once every time, efficiency is relatively low.
Before a compiled language used to write the program execution, requires a special compilation process through 编译系统
, the senior program source file compiled into machine language translation only once, run do not need translation, so high-compiled language program execution efficiency but it can not be generalized,
Part interpreted language interpreter by a dynamic optimization code at runtime, even performance than the interpreted language compiled language.
Problem 2: Python interpreter and the kind of features?
Python
When the official website to download and install Python good Python2.7, direct access to an official version of the interpreter: Cpython, the interpreter is written in C language development, so called CPython, run python named in the line, it is to start CPython interpreter, CPython is the most widely used Python interpreter.
IPython
IPython is based on an interactive interpreter over CPython, that is to say, just IPython has been enhanced in the interactive mode, but the execution of the functions and CPython Python code is exactly the same, like many domestic browser Although the appearance is different, but In fact, the kernel is called IE.
- PyPy
PyPy another Python interpreter, which target speed is performed, using JIT PyPy technology, Python dynamically compiled code, it is possible to significantly improve the execution speed of the Python code.
- Jython
Jython Python interpreter is running on the Java platform, Python code can be directly compiled into Java bytecode execution.
- IronPython
IronPython and Jython similar, but IronPython Python interpreter is running on the Microsoft .Net platform, Python code can be directly translated into .Net byte code.
In the Python interpreter, using 广泛的是CPython
, for compiling Python, in addition to the above can be used out-compiled interpreter, highly skilled developers can write Python interpreter in accordance with their own needs to execute Python code, very convenient!
Question 3: Relationship of bits and bytes?
- bit is bit, also known as bits, is the computer represents the smallest unit of data
- byte is a byte
1byte=8bit
1B is 1byte
A 2-byte character =
1KB=1024B
Byte is Byte, B is
Bit is bit is b
Conversion relationship is as follows:
- 1KB=1024B
- 1B= 8b
Question 4: The difference between byte code and machine code?
Machine code (machine code)
机器码(machine code)
, Scientific name machine language instructions, sometimes referred to as native code (Native Code), the computer is CPU
directly interpret data.
Understood in the usual sense of the word, that is, the computer can directly execute machine code, and perform the fastest code.
Written in machine language program, the programmer must first memorize the meaning of all the instruction code and the code used by computers.
When the hand-programmed, programmers have their own storage allocation and processing each instruction and each input and output data have to remember what state during programming unit of work used in each step.
This is a very tedious work, time spent programming is often several times or several hundred times the actual running time.
Further, a program to compile the code for all such instructions 0 and 1, intuitive difference, error-prone.
Now, in addition to computer manufacturers professionals, the vast majority of programmers no longer have to learn the language of the machine.
Machine language understood by a microprocessor and used for controlling the operation of its binary code.
The machine instruction 8086 to the Pentium length may be from 1 byte to 13 bytes.
While the machine language seems to be very complicated, but it is regular.
There are as many as 100,000 kinds of machine language instructions. This means that these species can not list them all.
Summary: machine code is the computer CPU machine instructions directly read run, the fastest, but very obscure, but also more difficult to write, the reach of general practitioners.
Byte code (Bytecode)
字节码(Bytecode)
Comprising program is executed by a sequence of op code / data of the binary composition. Intermediate byte code is a code which is more abstract than the machine code, the interpreter needs to be translated to machine code of the intermediate code.
Often it is has been built, but nothing to do with the specific machine code. Bytecode usually not the same people can read the source code, but encode the constant value, references, sequence of instructions and the like.
In order to achieve the main bytecode run specific software and software environment, independent of the hardware environment. Implementation by bytecode compiler and virtual machines. Compiler to compile the source code into byte code, a virtual machine on a particular platform translates bytecode instruction can be executed directly. Typical applications for the bytecode Java bytecode.
Byte code at runtime JVM (JAVA Virtual Machine) generates machine instructions to do a conversion, thus better able to cross-platform operation.
Summary: The intermediate state is a byte code (intermediate code) binary code (files). After the interpreter needs to be translated to machine code.
Question 5: Python3 difference between int and long and Python2 in?
Python 2 had a non-floating point type int and long preparation.
int type can not exceed the maximum sys.maxint, and the maximum value is platform-dependent.
Can be attached at the end of the digital to define a long integer L, obviously, it is greater than the numerical range expressed int.
In Python 3, there is only one integer type int, in most cases, it is much like Python 2, long integer.
Since the two types, does not exist, so there is no need to use special syntax to distinguish them.
Question 6: Focus on questions, most recently updated in public a magic number of how-to articles series
Welcome dream eraser public concern number search - non-programmers to undergraduate
Open direct concern