Survey of programming languagesSurvey of programming languages
Click to rate this post!
[Total: 0 Average: 0]

This Article shows Qestions and Answer workings for the Post Graduate Diploma program of Federal Polytechnic Bauchi in Affiliation with Joseph Sarwvan Tarka University, Markurdi.

These Questions are randomly picked based on the topics in the syllabus for Survey of Programming Languages and it’s helpful for those currently writing their on going exams in the department of Statistics and Computer Science.

N.B – These questions and answers are uploaded only as a guide and ease for your studies.

Below are the Questions:

COURSE TITLE: SURVEY OF PROGRAMMING LANGUAGES

COURSE CODE: CMP 721

CLASS: PGD (COMPUTER SCIENCE)

INSTRUCTION: ANSWER ANY FIVE (5) QUESTIONS

TIME ALLOWED: 2½ HOURS

QUESTION 1

1a. Define the term programming language survey?

1b. State and briefly explain the reasons for studying the concept of programming language.

1c. Define the following terms;

 (i) syntax

(ii) semantic

(iii) pragmatics

1d. Define computer programming

QUESTION 2

2a. What are the classifications of programming languages

2b. State three features of the following languages:

(i) Low Level Languages

(ii) Middle Level Languages

(iii) High Level Languages

2c. List five attributes of a good program. Explain any two.

2d. List and explain the roles of programming languages

QUESTION 3

3a. Define the term programming language paradigms

3b. List the types of programming paradigms and explain any two

3c. List the key concept of object oriented programming languages

3d. Explain the following terms:

(i) Parse tree

(ii) Syntax violation

(iii) Grammar

(iv) Parsing

QUESTION 4

4a. What are arithmetics operators?

4b. List and explain the two types of arithmetic operators

4c. Write any three assignment operators and explain its usage (with examples)

4d. Write a simple program in C

QUESTION 5

5a. Differentiate between the two; implicit variable declaration and explicit variable declaration

5b. Programming languages are categorized into two kinds of data types. Name them, and give example each.

5c. List and explain the types of variables in programming language

5d. Write a simple program in C++

QUESTION 6

6a. Define the term concurrent programming language

6b. Explain the meaning of the elements (T,N,P,S)

6c. Briefly explain Java programming language

6d. Write a simple program in Java

QUESTION 7

7a. Briefly explain python programming language

7b. List 10 factors that may influence the choice of a programming language

7c. Who is a programmer?

7d. Explain the differences in implementation abstraction and declaration in C and Java.

Below are the Answers:

1a. Definition of Programming Language survey: A programming language survey is a research tool used to collect information and opinions from a broad audience of developers and programmers about various programming languages. These surveys are designed to gather data on aspects such as language popularity, usage trends, satisfaction, and opinions on emerging technologies.

1b. The reasons for studying the concept of programming language.

(i) To improve your ability to develop effective algorithms  — Having a basic knowledge of the principles in implementation techniques of programming languages allows the programming to understand the cost of techniques in one language compared to another.

(ii) To Improve your use of existing Programming Languages  — when the features of a programming language is well understood the ability to write efficient program will increase.

(iii) To increase your vocabulary of useful programming construct — by studying different programming language construct a programmer increases programming vocabulary.

(iv) To allow better choice of programming languages — a knowledge of different languages allows making just the right choice for a project at hand.

(v) Advance in computing — studying programming languages lead to an overall advancement in computing because state of art application can be easily designed to solve current and challenging problems.

1c. Definitions of the following terms;

 (i) syntax — is concerned with how expressions, command declaration and other construct must be arranged to make a well formed program

See also  DATA STRUCTURE - 2022/2023 PGD PAST QUESTION & ANSWER

(ii) semantic — is concerned with the meaning of programs and how a well-formed program is expected to behave when executed.

(iii) pragmatics — is concerned with the way in which the language is intended to be used in practice.

1d. Definition of computer programming: computer programming is the act of writing a set of instruction that later be compiled and/or interpreted and then inherently transformed to an executable that computer system or other electronics machine can execute.

2a. Classifications of programming languages:

(i) Low Level Languages

(ii) Middle Level Languages

(iii) High Level Languages

(iv) Very High Level Language

(v) Higher Level Language

2b. Stating the features of the following languages:

(i) Low Level Language

a. Fast processing: All the computer instructions are directly recognized. Hence, programs run very quickly.

b. No need of Translator: The machine code is the natural language directly understood by the computer. Therefore, translators are not required. Assembly language on the other hand requires assemblers for conversion from mnemonics to equivalent machine code.

c. Error prone: The instructions are written using 0’s and 1’s. This makes it a herculean task. Hence, there are more chances of error prone codes in these languages. Errors are reduced in assembly language when compared to machine language.

(ii) Middle Level Language

a. They have the feature of accessing memory directly using pointers.

b. They use system registers for fast processing

c. They support high-level language features such as user friendly nature;

(iii) High Level Language

a. Third generation Language: High Level Languages are 3rd Generation Languages that are majorly refinement to the 2nd generation languages.

b. Understandability: programs written in High-level language is easily understood

c. Debugging: Errors can be easily located in theses languages because of the presence of standard error handling features.

2c. Attributes of a good program.

(i) Clarity, Simplicity and Unity

(ii) Portability of programs

(iii) Naturalness

(iv) Ease of Problem verification

(v) Support of Abstraction

Explain any two.

(i) Clarity, Simplicity and Unity — A good programming language should be an aid to the programmer by providing a clear, simple and unified set of concepts that can be used as primitives in developing algorithms. As for simplicity, a good programming language should have property in which constructs that mean different things look different, that is semantic difference should be clear in the language syntax.

(ii) Support Abstraction — an idea programming language should allow data structure, data types and operation to be defined and maintained as self-contained abstractions.

2d. Roles of programming languages:

(i) to improve computer capability

(ii) improve application

(iii) improved programming method

(iv) improved implementation method

(v) standardization

3a. Definition: programming language paradigms are ways to classify programming languages based on their features.

3b. Types of programming paradigms:

(i) Imperative language

(ii) Functional language

(iii) Object oriented language

(iv) Concurrent language

(v) Logic programming language

(vi) Scripting programming language

Explain any two

(i) Logic programming language — a logic program implements a relation. Since relations are more general than mapping, logical programming is potentially higher level than imperative or functional programming.

(ii) Scripting programming language — a software system often consists of a number of subsystem controlled or connected by a script. Therefore, a script is used to glue subsystems together.

3c. Key concept of object oriented programming languages (OOP):

(i) Objects (ii) Classes (iii) Subclasses (iv) Inheritance (v) Inclusion polymorphism

3d. Explaining the following terms:

(i) Parse tree — parse tree is also known as derivation tree. This is defined as an ordered, rooted tree that represent the syntactic structure of a string according to some context free grammar.

(ii) Syntax violation — A syntax violation, also known as a syntax error, occurs when a programming language or a set of rules governing the structure of a language (such as grammar or formatting rules) are not followed correctly.

See also  ENGINEERING IN SOCIETY - HND PAST QUESTIONS & ANSWERS

(iii) Grammar — A grammar is a set of production rules for the strings in the language

(iv) Parsing — Parsing is the process of analyzing a string of symbols or text to determine its grammatical structure and meaning.

4a. Definition of arithmetics operators: These are the operators used to perform arithmetic/mathematical operations on operands. Examples: (+, , “./.%,++,-)

4b. Arithmetic operator are of two types:

(i) Unary Operators: Operators that operates or works with a single operand are unary operators. For example: (+,-,*.)

(ii) Binary Operators: Operators that operates or works with two operands . For example: (++,–)

4c. Assignment operators and how they are used:

“=” This is the simplest assignment operator. This operator is used to assign the value on the

right to the variable on the left.

For example:

a= 10;

b=20;

ch =’y’;

“+=”:This operator is combination of ‘ and ‘=’ operators. This operator first adds the current value of the variable on left to the value on right and then assigns the result to the variable on the left.

Example:

(a += b) can be written as (a = a + b) If initially value stored in a is 5. Then (a += 6) = 11.

“-=”:This operator is combination of and =’ operators. This operator first subtracts the

current value of the variable on left from the value on right and then assigns the result to the

Variable on the left.

Example:

(a -= b) can be written as (a = a – b)

If initially value stored in a is 8. Then (a -= 6) = 2.

“*=”:This operator is combination of * and =’ operators. This operator first multiplies the

current value of the variable on left to the value on right and then assigns the result to the

variable on the left.

Example:

(a *= b) can be written as (a =a * b) If initially value stored in a is 5. Then (a *= 6) = 30.

“/=”:This operator is combination of and = operators. This operator first divides the current

value of the variable on left by the value on right and then assigns the result to the variable on

the left.

4d. A simple program in C

#include <stdio.h>

int main(0{

/* my first program in C*/

}

printf(“Hello, World! \n”);

return 0;

5a. • Implicit Variable Declaration — in Implicit Variable Declaration programming languages in which the variables to be used in a program may not be declared are said to support implicit variable declaration. A good example of programming language that supports this variable declaration type is Python. That is, in Python, a programmer may declare or choose not to declare the variable that he intends using in a programming language.

• Explicit Variable Declaration — Programming languages in which the variables to be used in a program should be declared are said to support Explicit variable declaration. Examples of such languages that support explicit variable declaration are: Java, C, C++, PASCAL, FORTRAN, and many others.

5b. Programming languages are categorized into two kinds of data types. Namely, Simple and Composite data.

5c. Listing and explaining the types of variables in programming language

(i) Global variable

A Global variable is the kind of variable that is accessible from other classes outside the

program or class in which it is declared. Different programming languages have various of ways in which global variables are being declared, when the need arises.

(ii) Local Variable

A local variable is the kind of variable that is not accessible from other classes outside the program or class in which it is declared. These are variables that are used within the current program unit (or function) in a later section we will looking at global variables are available to all the program’s functions.

See also  COMPUTER COMMUNICATION AND NETWORKS – 2022/2023 PGD PAST QUESTIONS & ANSWERS

The Basic data types associated with variables in languages such as C and Java. These include

the following:

1. int- integer: a whole number

2. float- floating point value: i.e a number with a fractional part.

3. double -a double-precision floating point value.

4. char- a single character.

5. Byte

5d. A simple program in C++

#include <iostream.h>

using namespace std

int main() {

/* my first program in C++ */

Cout<<(“Hello, World! \n”);

return ;

6a. Defining the term concurrent programming language: a concurrent programming language is defined as one which uses the concept of simultaneously executing processes or trends of execution as a means of structuring a program.

6b. Explaining the meaning of the elements (T,N,P,S) —

a. T is a set of tokens. Tokens form the vocabulary of the language and are the smallest units of syntax.

b. N is a set of nonterminals. Nonterminals are not part of the language per se. Rather, they help to determine the structure of the derivation trees that can be derived from the grammar.

c. P is a set of productions rules. Each production is composed of a left-hand side, a separator and a right-hand side, e.g., <non-terminal> ;= cexpr1> … <exprN>, where ‘=’ is the separator.

d. S is a start symbol. Any sequence of derivations that ultimately produces a grammatically valid program starts from this special non-terminal.

6c. Java programming language — Java is an Object Oriented Language – In Java, everything is an Object. Java can be easily extended since it is based on the Object model.Object-oriented programming (0OP) is a programming language model organized around objects rather than “actions” and data rather than logic.

6d. A simple program in Java

/ This is a Java program to display a message to the monitor screen “/

public static void main(String [(largs) (

public class MyFirstUavaProgram (

System.out.printin (“Survey of programming language “);

}

}

7a. Python programming language — Python is another High Level Programming Language that is used for building a wide range software solutions (applications).

7b. Factors that may influence the choice of a programming language

i. Programmer experience. This is basically the level of technical-know-how of the programmer

ii.Ease of Development and Maintenance (Simplicity)

ii.Suitability of the programming language for the problem

iv.Readability

v. Error Checking

vi.Reliability

vii.Portability- This feature allows the programmer to program to run on many different platforms, with minimal rewriting.

viii.Efficiency- The compiler should be fast. The code itself should be fast.

ix. Low Learning Curce- The language should be easy to learn. Training is expensive.

x.Reusability- Writing software components once is cheaper than writing them twice.

7c. A programmer is expected to master the syntax and semantics of the programming language while at the same time understand the logic required for solving each problem.

7d. Explaining the differences in implementation abstraction and declaration in C and Java.

1. Implementation:

In C, we use functions provided by the standardlibrary (stdio.h, stdlib.h) and éxplicitly define the factorial function.

– In Java, we define a class (Factorial’) with a static method (‘factorial’) to calculate the factorial.

2. Abstraction:

In the C program, the abstraction level is relatively low. We directly define and call the

factorial function, without any object-oriented concepts.

– In the Java program, we use object-oriented principles. We define a class, encapsulating the

functionality related to factorial calculation. The method ‘factorial is encapsulated within the

class, providing a higher level of abstraction.

3. Declaration:

– In C, we explicitly specify the data type (‘int’) for each variable.

-In Java, we also declare variables(‘num and fact ), but Java treats- primitive data types (‘int)

as objects, so there’s no need for explicit memory allocation or deallocation.

Loading

Click to rate this post!
[Total: 0 Average: 0]

By BRUCASBLOG

My name is Masud Umoru, a passionate blogger and the driving force behind Brucasblog. I am deeply committed to researching the most sought-after topics on the web and transforming them into engaging, informative, and easy-to-read content. With a strong dedication to helping our readers stay updated and well-informed, I ensure that Brucasblog provides the best reading experience for our visitors.

Leave a Reply

Your email address will not be published. Required fields are marked *