Error-prone questions about programming languages

Error-prone questions about programming languages

  1. There are at most () communication paths for a development team with 8 members.
    A, 28 B, 32 C, 56 D, 64

    Analysis
    The communication path of the software development team is influenced by the teamorganizational formandscaleImpact. If a communication path is possible between any group member, usefully connected graphTo model the communication path of the development team, the most communication path is the number of edges of the fully connected graph, that is, the communication path of the development team with n members isn(n-1)/2, so there are 28 communication paths for a development team with 8 members.

  2. Compilers and interpreters are two basic high-level multiple-choice language processing programs. The compiler's processing of high-level language source programs can be divided into stages such as lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and object code generation. Among them, (1) not everytranslaterBoth are required, compared to the compiler, the interpreter (2).
    (1)
    A. Lexical analysis and syntax analysis
    B. Semantic analysis and intermediate code generation
    C. Intermediate code generation and code optimization
    D. Code optimization and object code generation
    (2)
    A. Does not participate in operation control, slow program execution speed
    B . Participate in operation control, the speed of program execution is slow
    C. Participate in operation control, the speed of program execution is fast
    D. Not participate in operation control, the speed of program execution is fast
    Analysis

  3. A language that can be used to write stand-alone programs and quick scripts is ( ).
    A. Python B. Prolog C. Java D. C#

    parsing
    scripting language also known asextended language,ordynamic language, is a programming language, usually saved as text (such as ASCIl), and is only interpreted or compiled when called.Python is a scripting language

  4. In the following descriptions about the compilation and interpretation methods implemented by high-level programming languages, the correct one is ().
    A. The compiler does not participate in the operation control of the user program, while the interpreter does.
    B. The compiler can be written in a high-level language, while the interpreter can only be written in assembly language.
    C. Compilation does not optimize the source program while interpreting The method is optimized
    D. The compilation method does not generate the target program of the source program, while the interpretation method generates

    The parsing
    interpreter is also called an interpreter, which either directly interprets and executes the source program, or convertsThe source program is translated into some kind of intermediate codeThen execute
    the compiled program (compiler) to translate the source program intotarget language program, and then run the target program on the computer.
    The fundamental difference between these two language processing programs is: in the compilation mode, the target program equivalent to the source program is run on the machine,Neither the source program nor the compiled program participates in the execution of the target program; while in interpreted mode,The interpreter and the source program (or some equivalent representation thereof) participate in the execution of the program, the control of the running program is in the interpreter. To put it simply, in the interpretation mode, an independent object program is not generated when the source program is translated, but the compiler translates the source program into an independently stored object program.

  5. It is known that a high-level language source program A is compiled to obtain the target program B on the machine C, then ().
    A. Decompile B, but the source program A cannot be restored.
    B. Disassemble B, and the assembler code equivalent to the source program A cannot be obtained.
    C. Decompile B, and the variable of the source program A is obtained. Statement and algorithm flow
    D, cross-compile A and B, can generate a dynamic link library running on machine C

    Analysis
    Compilation is the translation of high-level language source programs into machine language programs (assembly form or machine code form), and decompilation is the reverse process of compilation. decompile usuallyCannot restore executable files to high-level language source code, onlyinto a functionally equivalent assembler

  6. ( ) is a functional programming language.
    A. Lisp B. Prolog C. Python D. Java/C++

    Analytical
    LISP is a general-purpose high-level computer programming language that has monopolized the application of artificial intelligence for a long time. As a language designed for artificial intelligence, LISP isThe first declarative intrinsic functional programming language, which is different from structured programming languages ​​such as imperative-style procedural C, Fortran and object-oriented Java, C#.

  7. Among all the strings composed only of characters a and b, the set of strings ending with b can be expressed as ().
    A, (b|ab)* b B, (ab* )* b C, a* b* b D, (a|b)* b

    analyze
    insert image description here

  8. When dividing the working process of the compiler into lexical analysis, semantic analysis, intermediate code generation, code optimization and object code generation, the input of the syntax analysis stage is (/) if the parentheses in the program are not matched, it will be checked in the () stage something went wrong.
    A. Lexical analysis B. Syntax analysis C. Semantic analysis D. Object code generation

    Analyzing
    the stream of tokens , the output of the lexical analysis istoken flow, that is, the grammatical analysisenter.
    Character streams , in Java, are divided into byte streams and character streams according to the different data units processed. A character stream is composed of characters, such as FileReader, FileWriter, BufferedReader, BufferedWriter, InputStreamReader, OutputStreamWriter, etc. Irrelevant to this topic.
    source program , the task of lexical analysis is tosource stringconverted tosequence of word symbols.
    Parse tree , if there is no grammatical error, it will be correct after grammatical analysisconstruct its syntax tree. Mismatched parentheses are typical syntax errors and are detected during the parsing phase.

  9. The storage space for global variables in a C program is allocated in ().
    A. Code area B. Static data area C. Stack area D. Heap area

    Analysis
    The user memory space when the program is running is generally divided intoCode area, static data area, stack area and heap area, where the stack area and the heap area are also called dynamic data areas .The storage space of global variables is in the static data area

  10. When an expression is expressed in reverse Polish notation, use () to evaluate it.
    A, stack B, queue C, symbol table D, hash table

    Analytical
    suffix (reverse Polish) is a method of expressing expressions invented by Polish logician Luka Siewicz. This way of expressingThe operator is written after the operand, For example, write a+b as ab+, so it is also called suffix type.With stackPostfix expressions can be evaluated conveniently. The method is: first create an initially empty stack to store operands. When evaluating a suffix expression, the expression is scanned from left to right. If an operand is encountered , it is pushed onto the stack. If an operator is encountered, the required operand is popped from the top of the stack and the operation is performed, and the result is then Push the top of the stack , and so on, until the end of the expression.

  11. In the compilation process divided by stages, judging whether the form of the multiple-choice program statement is correct belongs to the work of the () stage
    A, lexical analysis B, syntax analysis C, semantic analysis D, code generation

    Analysis
    The composition rules of words (symbols) in programming languages ​​can be described by regular expressions, and the basic task of
    lexical analysis isIdentify every word in the source program.
    Syntax analysis is the analysis of statements and programsWhether the structure conforms to the specification defined by the language, for grammatically correct sentences, semantic analysis is to judge the sentenceIs the meaning correct, so judging whether the form of the statement is correct is the work of the syntax analysis stage.

    Lexical analysis : scan the source one by one from left to rightcharacters in the program, identifying such as keywords (or reserved words), identifiers, constants, operators, and separators (punctuation marks and brackets), etc.
    Grammatical analysis : According to the grammatical rules, theWord symbols are decomposed into various grammatical units, and analyze the source program for grammatical errors. Including: language structure error, if...end if mismatch, missing semicolon, bracket mismatch, expression missing operand, etc.
    Semantic Analysis : GoType analysis and checking, which mainly detects whether there are static semantic errors in the source program. Including: the operator does not conform to the operation type, such as using floating-point numbers when taking the remainder.

  12. In the process of translating high-level language source programs into machine language programs, intermediate codes are often introduced. In the following description about the intermediate code, the incorrect one is (D).
    A. The intermediate code does not depend on the specific machine
    B. Using the intermediate code can improve the portability of the compiled program
    C. The intermediate code can be represented by a tree or a graph
    D. The intermediate code can be represented by a stack and a queue

    The analysis
    intermediate code is an internal representation of the source program, or intermediate language. The role of the intermediate code is to make the structure of the compiled program inLogically more simple and clear, using intermediate codes improvesPortability of Compiled Programs, the common ones areReverse Polish notation, quaternions, ternaries, and trees

Guess you like

Origin blog.csdn.net/qq_52108058/article/details/130743344