Programming Languages

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Following are some programming language evaluation criteria: 1) Writability 2) Reliability 3) Cost 4) Readability

1) Writability 2) Reliability 3) Cost 4) Readability

Given the following grammar, which sentential form can be generated from it in a leftmost derivation? <assign> is the start symbol. (select all correct ones)

A = A

Which statements below are correct? (Select all that apply)

A sentential form is a string of terminal and/or non-terminal symbols derived from the start symbol A sentence is a sentential form that contains only nonterminals A leftmost derivation is one in which the leftmost nonterminal in each sentential form is expanded

Studying concepts of programming languages would allow for

Better understanding of significance of implementation Increased ability to learn new languages Better use of languages that are already known Improved background for choosing appropriate languages

The following is an example of a Systems Programming language:

C

Which of the following sentences can the following BNF rule generate? (Select all that apply) <items> --> A | B | C<items>

CCCB A

Select all the correct statements.

Compilers often base the semantics of language structures on their syntactic form Compiler chooses the code to be generated for a statement by examining its parse tree If a language structure has more than one parse tree then the meaning of the structure cannot be determined uniquely

Reliability refers to

Conformance to specifications

The following mechanisms can be used to describe the syntax of programming languages. (Select all that apply)

Context Free Grammars Backu-Naur Forms

Which statement is correct? (Select all that apply)

Every internal node of a parse tree is labeled with a nonterminal symbol Every leaf is labeled with a terminal symbol Parse tree is a hierarchical representation of a derivation

What programming language has dominated scientific computing over the past 60 years or so?

FORTRAN

Characteristics of readability are the same as those of writability and vice versa.

False

In BNF, a terminal symbol can be changed by a production rule.

False

Language Implementors are the individuals who use the language to develop a software for a particular application.

False

The forms of the tokens of programming languages can be described by context-free grammars.

False

The following contribute to the cost of using a programming language: (select all that apply)

How close a programming language is to its domain of use If the language is a compiled vs. interpreted language Level of knowledge of programmers Extent of the existing features to support reliability of written program

Some examples of programming language categories are (select all that apply)

Imperative Logic Declarative

The study of programming languages is valuable for a number of reasons: (select all that apply)

Increases our capacity to use different constructs Enables us to choose languages more intelligently Makes learning new languages easier

Which statement below is correct? (select all that apply)

Interpreter allows for easier implementation of programs Compiled programs require less space than interpreted programs Compiled programs execute faster than the interpreted programs

In a BNF rule (Select all that apply)

LHS of the rule must be a nonterminal.

The following help achieve simplicity in a language:

Minimal operator overloading

Some programming language methodologies are (select all that apply)

Object-oriented Data-oriented Procedure-oriented

In the fetch-decode-execute-cycle (on a Von Neumann architecture computer) (select all that apply) - note that a fetched instruction can be a jump instruction!

Program counter is incremented after each fetch operation Program counter may be changed as a result of the execute operation Program counter may be changed during the decode operation Program counter is initialized before the cycle starts

Users of a language definition are (Select all that apply)

Programmers Compiler and interpreter creators Implementors of the language Other language designers

The statement "if (Boolean_expr) statement" (Select all that apply)

Shows the syntax of the if-statement Implies the semantics of if-statement

Which definition is correct?

Syntax analyzer transforms lexical units of a program into syntactic structure of the program

Type checking in a programming language can be done during: (select all that apply)

The following characteristics increase reliability of a program: (select all that apply)

BNF is a method for describing the grammar of a programming language.

True

Language designers are the individuals who decide the constructs and features of a programming language

True

Language users are the individuals who use a programming language to develop a program for a particular application.

True

Use of a Boolean data type (e.g., Boolean finished = true) instead of an integer data type (e.g., integer finished = 1) in defining variables, which can store only one of two values, usually help the readability of a program.

True

User-defined operator overloading may harm the readability of a program.

True

Von Neumann computer architecture was the basis of design of imperative languages

True

In general, languages can be defined formally in following ways: (Select all that apply)

by generation by recognition

A --> <B> + C is a valid BNF rule.

false

A language is a set of characters in an alphabet.

false

Context-free grammars were initially developed to describe programming languages. They were later used to describe natural languages such as English.

false

Is the following grammar ambiguous? (Justify it for yourself!) <A> --> <A> a <A> --> b

false

Given the following statement, average = (num1 + num2) / 2 What does each lexical unit below represent? (Select all correct representations)

left_paren is a token average is a lexeme equal_sign is a lexeme ( is a lexeme

A grammar is ambiguous if and only if it generates a sentence that has two or more distinct parse trees.

true

A nonterminal symbol, in the BNF notation, is enclosed in angle brackets, <>

true

A start symbol in an BNF rule must be a nonterminal symbol.

true

Consider the sentence "aba" and the following grammar. Is the grammar ambiguous? (Justify it for yourself!) <A> --> <A> a <A> --> a <A> <A> --> b

true

In an arithmetic expression, an operator, which is generated lower in the parse tree, indicates that it has precedence over an operator produced higher up in the tree.

true

It is possible to merge multiple BNF rules into one rule.

true

Orthogonality is one of the characteristics contributing to the readability of a language. Orthogonality refers to having a small number of primitive constructs, which can be combined in a small number of ways to build the structures of a language.

true

The category of a given lexeme is called token.

true

The syntax of a programming language shows the structure of the different language elements such as statements and expressions.

true


Kaugnay na mga set ng pag-aaral

AP US History Semester 1 Final Ch 15-17

View Set

THE INTERNATIONAL SCENE OF THE 1970s

View Set

Health: Unit 4, Assignment 20 (Quiz) (unchecked)

View Set

Which study can I use? Options ERQ edition.

View Set

314 exam 2 practice questions - MUSCULOSKELETAL

View Set

Networking Devices and Initial Configuration

View Set

Magento 2 Certified Solution Specialist - Content Area 1: Ecommerce

View Set