2021-09-20T13:59:40+03:00[Europe/Moscow] en true <p>What is the difference between a pseudo code and programming languages?</p>, <p>What is an algorithm?</p>, <p>Compare and contrast the terms <strong>ambiguous</strong>, <strong>deterministic</strong> and <strong>complete</strong> as applied to algorithms.</p>, <p><u>Answer true or false to each of the following</u>:</p><p>1. An algorithm is a plan for solving a problem by following a sequence of instructions.</p><p>2. Breaking down an abstract algorithm into a more detailed one is called stepwise refinement.</p><p>3. Programmers always have to write every instruction that forms part of their final program.</p><p>4. Parameters are a way of making subprograms more generally applicable and useful.</p><p>5. English is always an appropriate language in which to express algorithms.</p>, <p><u>Fill in the blanks in the following statements</u>:</p><p>1. Every Java program begins execution at the method ______.</p><p>2. The ___ symbol ends the body of every method.</p><p>3. Commands are started with either the ___ or ___ characters.</p><p>4. The ______ symbols define the &lt;newline&gt; character, which moves the output cursor to a new line.</p><p>5. An error which is caught by a compiler is a ______ error.</p> flashcards
Informatics Year 1 Semester 2

Informatics Year 1 Semester 2

  • What is the difference between a pseudo code and programming languages?

    In pseudo code, the control structures (while and if) of a programming language are combined with statements in a natural language such as English. The aim is to provide a language for writing algorithms without worrying about the detailed syntax of a programming language.

    A programming language is a language (such as Java, C++ or Pascal) that is used to give instructions to a computer. It is defined by formal rules that specify the grammar of the language.

  • What is an algorithm?

    An algorithm is a sequence of instructions that, if followed, will result in some problem being solved. It is a set of actions together with the order in which they are to be performed. For example, an algorithm to search through a pile of CDs (written in pseudo code) would be:

    Look at top CD

    Check if it is CD searched for

    WHILE it’s not the required CD AND there are more CDs

    Move to next CD

  • Compare and contrast the terms ambiguous, deterministic and complete as applied to algorithms.

    ● Ambiguous means that there could be multiple interpretations to an instruction. One person an instruction meant to do one thing; someone else, that it meant to do a different thing.

    ● Deterministic means the algorithm does the same thing every time. If it is non-deterministic, then even if everyone agrees what should be done (i.e. it is unambiguous) different results can still occur (e.g. throwing a dice – everyone may agree on what this means but when we do it we get a different result so it is unambiguous but non-deterministic).

    ● Complete means all cases are covered: there is no situation that can arise where the algorithm does not tell you what to do. This could occur if a branching instruction told you what to do if the test was true, but gave no indication of what to do if it was not.

  • Answer true or false to each of the following:

    1. An algorithm is a plan for solving a problem by following a sequence of instructions.

    2. Breaking down an abstract algorithm into a more detailed one is called stepwise refinement.

    3. Programmers always have to write every instruction that forms part of their final program.

    4. Parameters are a way of making subprograms more generally applicable and useful.

    5. English is always an appropriate language in which to express algorithms.

    1. True This describes what an algorithm is.

    2. True

    3. False It is often possible to reuse existing programs as subprograms, thus saving a lot of development time.

    4. True Yes, parameters make it possible to write a subprogram able to behave differently for different parameters.

    5. False English can be ambiguous, and must be used very carefully.

  • Fill in the blanks in the following statements:

    1. Every Java program begins execution at the method ______.

    2. The ___ symbol ends the body of every method.

    3. Commands are started with either the ___ or ___ characters.

    4. The ______ symbols define the <newline> character, which moves the output cursor to a new line.

    5. An error which is caught by a compiler is a ______ error.

    1. main()

    2. close brace “}”

    3. “//” (or “/*” for multi-line comments – which are terminated with “*/”)

    4. \n

    5. Syntax, or compile-time, or static