SURVEY OF PROGRAMMING LANGUAGES – 2022/2023 PGD PAST QUESTIONS & ANSWERS

Survey of Programming Languages - CMP 721

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

This Past Question is for the year 2022/2023 Academic Session, 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:

JOSEPH SARWVAN TARKA UNIVERSITY, MAKURDI

COLLEGE OF SCIENCE,

DEPARTMENT OF MATHEMATICS, STATISTICS AND COMPUTER SCIENCE

FIRST SEMESTER EXAMINATION 2023

COURSE TITLE: SURVEY OF PROGRAMMING LANGUAGES

COURSE CODE: CMP 721

CLASS: PGD (COMPUTER SCIENCE & STATISTICS)

INSTRUCTION: ANSWER ANY FIVE (5) QUESTIONS

TIME ALLOWED: 2Β½ HOURS

QUESTION 1

a. What is the objective of conducting a programming language survey?

b. Provide four examples of popular programming languages commonly utilized in today’s industry

c. Regarding categories, discuss two of the programming languages mentioned in your previous answer.

d. Provide a historical overview of two programming languages mentioned in your answer in ‘b

QUESTION 2

a. What are the primary considerations to take into account when choosing a programming language for a particular project?

b. What are the benefits and drawbacks of utilizing a strongly typed programming language?

c. Examine and highlight similarity and difference between procedural programming and object -oriented programming paradigms.

QUESTION 3

a. Elaborate on the distinction (similarities and differences) between a compiled language and an interpreted language.

b. Explain the significance of language portability in the context of software development.

c. Explain four types of algorithms with examples each.

QUESTION 4

a. Explain the concept of language syntax in programming languages.

b. Give three examples of syntax error using a programming language of your choice (indicate which language is being used)

c. Explain each example given in 4b’.

QUESTION 5

a. Why are semantic errors difficult to detect?

b. State two common semantic error types that may occur in programming

c. Indicate if there is a semantic error below: (python codes)

i. result = 10/0 #Division by zero

print(result)

ii. numbers = [1, 2, 3, 4, 5]

total =numbers.sum()

iii. numbers = [1, 2, 3, 4, 5]

print(numbers[ 10])

iv. number =5

text =”Hello, World!”

result = number + text

v. value = 42

 result = value + 8

d. state reasons for your answer in 5b.

QUESTION 6

a. write short notes on the following: (you are advised to use your own understanding)

i. Procedure

ii. Functions

iii. Error handling techniques

iv. Scope

v. Lexemes

vi. Tokens

vii. ldentifiers

QUESTION 7

a. Explain what you understand by control structures

b. Explain the following:

i. Conditional statements

ii Loop structures

c. State three types of:

i. Conditional statements

ii. loop structures.

d. What is type inference? Give one example of programming language that uses type inference

Below are the Available Answers:

ANSWERS TO 2022/2023 SURVEY OF PROGRAMMING LANGUAGES PAST QUESTIONS

1. Objectives of conducting programming language survey

(i) Evaluating Language Suitability

(ii) Understanding Community Sentiment

(iii) Enhancing Language Development

(iv) Informing Education and Training

(v) Assessing Popularity and Trends

(vi) Identifying Emerging Technologies

b. Popular Programming Languages commonly utilized in today’s industry.

(i) Java programming language

(ii) C Programming Language

(iii) C++ Programming Language

(iv) Python programming language

See also  Beware of False Rumors: Batch B Stream II, 2024 NYSC Orientation Camp Schedule Yet to Be Announced

c. Discussion on C and C++

(i) C Programming Language β€” C is a Compiled procedural, imperative programming language made popular as the basis of Unix. The language is very popular and is found useful in building mathematics and scientific applications.

(ii) C++ Programming Language β€” C++ is a Compiled programming language that is based on C, with support for object oriented programming. It is one of the most widely used programming languages currently available. It is often considered to be the industry-standard language of game development, but is very often used to write other types of computer software applications.

d. Brief History of C and Java

(i) C Programming Language β€” The C programming language was developed in the early 1970s by Dennis Ritchie at Bell Laboratories. It was created as an enhancement to the B programming language, which was primarily used for system programming on early Unix systems. The development of C was motivated by the need for a Higher-level language that could be used to write efficient and maintainable code while retaining the low-level access to hardware required for system programming.

(ii) Java programming language β€” Java is a popular object-oriented programming language that was developed by James Gosling at Sun Microsystems in the early 1990s. It was initially designed for use in consumer electronics, particularly interactive television, but evolved into a general-purpose programming language suitable for various platforms.

2. Primary consideration in choosing a programming language for a particular project 

(i) Project Requirements: Consider the specific needs and objectives of your project.

(ii) Costs and Licensing: Some languages or their associated tools may require licensing fees, which can impact your project’s budget.

(iii) Maintenance and Scalability: Your choice of language should support the long-term maintenance and growth of your project.

(iv) Ease of Learning and Use: The complexity of a programming language can significantly impact your development process.

(v) Performance: Depending on your project, performance may be a crucial factor.

b.   Benefits and drawbacks of utilizing a strongly typed programming language

Benefits:

β€’ Type Safety: Strongly typed languages enforce type compatibility, ensuring that only valid operations are performed on data. This prevents type-related errors, enhances code reliability, and reduces debugging time.

β€’ Performance: Strict type checking can enable aggressive compiler optimizations, leading to more efficient code execution.

β€’ Readability: Code written in strongly typed languages can be easier to understand, as variable types are explicitly declared and data structures are well-defined.

β€’ Documentation: Explicit typing often leads to self-documenting code, making it easier for other developers to comprehend the purpose and usage of different variables and functions.

β€’ Scalability: Strong typing facilitates code maintenance and refactoring, as type-related errors are caught earlier in the development process.

Drawbacks

β€’ Increased Code Verbosity: Explicit type declarations can result in more verbose code compared to dynamically typed or weakly typed languages.

β€’ Steeper Learning Curve: For beginners, the additional type syntax and concepts can add complexity to the learning process.

β€’ Reduced Flexibility: Strong typing may limit the ability to write generic functions or perform certain operations that require dynamic type behavior.

β€’ Development Time: Explicit type management can increase development time, particularly during initial coding and debugging stages.

d. Similarity and difference between procedural and object oriented programming

See also  OLD AGE

Similarities:

(i) Basic Control Structures: Both procedural and object-oriented programming utilize similar basic control structures, such as loops, conditionals, and function calls.

(ii) Imperative Approach: Both paradigms follow an imperative approach, where programs are built around procedures or methods that execute step-by-step instructions.

Differences:

(i) Program Organization:

β€’ Procedural programming focuses on procedures or functions that operate on data, separating data from procedures. Data is often passed between procedures as parameters.

β€’ Object-oriented programming organizes code around objects, which encapsulate data (attributes) and operations (methods) within a single entity. Data and methods are closely tied together within the object.

(ii) Data and Behavior:

β€’ In procedural programming, data and behavior are treated separately. Data structures are defined separately from procedures, and procedures manipulate data structures.

β€’ In object-oriented programming, data and behavior are closely intertwined within an object. Objects have both attributes (data) and methods (behavior) that operate on that data.

(iii) Inheritance:

β€’ Procedural programming does not support the concept of inheritance.

β€’ Inheritance is a key feature of object-oriented programming, allowing classes to inherit attributes and methods from other classes, enabling code reuse and hierarchical organization of code.

3. Similarity and difference between a compiled language and an interpreted language

Similarities:

(i) Source Code: Both compiled and interpreted languages require developers to write source code, using various programming constructs, such as control structures, data types, and functions.

(ii) Programming Concepts: Regardless of the execution method, both types of languages share similar programming concepts, like loops, conditionals, and data manipulation.

Differences:

(i) Execution Method:

β€’ Compiled languages: The source code is converted into machine-readable instructions (compilation) before execution. This translation is performed by a compiler, generating an executable file or library that can be directly executed by the hardware.

β€’ Interpreted languages: The source code is translated to machine-readable instructions line by line during runtime. This interpretation is done by an interpreter that reads and executes each line of code one after another.

(ii) Portability:

β€’ Compiled languages: Since compiled code is specific to a target architecture or operating system, it may not be portable between different systems without recompiling the source code.

β€’ Interpreted languages: Interpreted code is typically more portable between systems, as the source code is usually not platform-specific and can be executed by an interpreter on multiple platforms.

(iii) Performance:

β€’ Compiled languages: Compiled code often has faster execution times because the translation to machine-readable instructions is done before execution, allowing for more efficient machine code generation and optimization.

β€’ Interpreted languages: Interpreted languages typically have slower execution times since each line of code needs to be interpreted and executed during runtime. This process can add overhead and slow down execution.

(iv) Development Process:

β€’ Compiled languages: The development cycle in compiled languages involves distinct steps: writing code, compiling, linking, and executing. Debugging compiled code can be more challenging due to the need for recompilation before testing changes.

β€’ Interpreted languages: Development in interpreted languages often involves a shorter cycle, where changes in the code can be immediately tested without needing to compile the entire program again. Debugging can be easier due to the ability to test code modifications quickly.

b. Significance of language portability in the context of software development 

See also  ENGINEERING IN SOCIETY - HND PAST QUESTIONS & ANSWERS

Language portability is a crucial aspect of software development as it determines how easily software can be adapted to run on different platforms, operating systems, or hardware architectures.  The significance of language portability can be understood from the following perspectives:

β€” Reusability and Maintainability: Portability allows developers to reuse existing code when creating new software or updating existing applications for different platforms.

β€” Expanded User Base: By enabling software to run on various platforms, portability allows developers to reach a broader audience, increasing the potential user base and revenue opportunities.

β€” Compatibility with Evolving Technology: Portability helps future-proof software by allowing it to adapt to new technologies and hardware architectures as they emerge.

β€” Developer Flexibility: Language portability gives developers the freedom to choose the most appropriate platform or hardware architecture for a given project without being contrained by compatibility issues.

c. Types of Algorithms with examples each 

β€” Search Algorithms: These algorithms are designed to find specific elements within a data structure or collection.

Example: Binary Search is a popular search algorithm that works on sorted arrays or lists. It repeatedly divides the search interval in half, narrowing down the range until the desired element is found.

β€” Sorting Algorithms: These algorithms are used to arrange elements in a particular order, typically ascending or descending.

Example: Quicksort is a widely-used sorting algorithm that employs a divide-and-conquer strategy. It selects a pivot element, partitions the array around the pivot, and recursively sorts the resulting sub-arrays.

β€” Graph Algorithms: These algorithms are designed to solve problems involving graph data structures, which consist of vertices (nodes) connected by edges (links).

Example: Dijkstra’s Algorithm is a graph algorithm that finds the shortest path between two vertices in a weighted graph with non-negative edge weights.

β€” Optimization Algorithms: These algorithms are used to find the optimal solution for a given problem, often by minimizing or maximizing specific criteria.

Example: The Knapsack Problem is a classic optimization problem that involves filling a knapsack with items of different weights and values to maximize the total value while keeping the weight within the knapsack’s capacity.

4. Explaining Concept of Language syntax in programming languages

Language syntax in programming refers to the set of rules, principles, and structural elements that govern how programmers should write code in a specific programming language.

b. Examples of syntax error with explanation:

(i) Missing or Misplaced Punctuation: In many programming languages, missing or misplacing punctuation marks can lead to syntax errors. For example, in C++, forgetting a semicolon at the end of a statement will result in a syntax error:

(ii) Mismatching Brackets or Braces: Opening and closing brackets or braces must be paired correctly. A syntax error will occur if there’s a mismatch. Here’s an example in Python with mismatched parentheses:

(iii) Incorrect Keyword Usage: Using incorrect or nonexistent keywords in a programming language can lead to syntax errors. For example, JavaScript uses [function] to declare a [function], so attempting to use another keyword like Function would result in a syntax error:

c. Answer to 4b

ajax-loader-2x SURVEY OF PROGRAMMING LANGUAGES – 2022/2023 PGD PAST QUESTIONS & ANSWERS

Share this content:


Discover more from BRUCASBLOG

Subscribe to get the latest posts sent to your email.

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.

3 comments

comments user
Rodolfo-D

Very interesting points you have noted, regards for putting up.Blog monry

comments user
Minna_D

Very interesting details you have remarked, regards for posting.Raise your business

Discover more from BRUCASBLOG

Subscribe now to keep reading and get access to the full archive.

Continue reading