Professional Documents
Culture Documents
CS 508
CS 508
CS 508
Assignment No 1
BC200407853
Question No. 1: Marks: 5
Compare the following code snippets in C and Ada. How do the operators and data types differ between the two
languages?
C Code Snippet:
Data Types:
Implicit Type Conversion:
C allows implicit type conversion between compatible data types, which can
sometimes lead to unexpected behavior. Ada is stricter, requiring explicit casting when
converting between data types.
Enumeration Types:
Both languages support enumerated data types but C’s syntax is simpler.
Record Types:
Ada offers a stronger record type system with features like named fields and
access types for safe manipulation. C’s record-like structures are less structured.
Pointer Arithmetic:
C allows pointer arithmetic, which can be powerful but also error-prone. Ada
avoids pointer arithmetic for safer memory management.
You are required to fill out the following table correctly by writing the name of appropriate language in front
of each row.
Note: Please don’t create a new table; use the following table only.
Statement Appropriate
Language
The programming language was designed primarily for hardware description. VHDL(VHSIC
Hardware Description
Language)
The programming language known for its powerful operators for string pattern Perl
matching but suffered from poor readability and maintainability.
The first programming language introduced the concept of a class, which served as Stimuli
the basis for data abstraction.
The programming language was primarily designed for teaching structured Pascal
programming and gained popularity for its simplicity and size.
The programming language designed for systems programming at Bell Labs, which C
evolved from B and was influenced by ALGOL 68.
Suppose you as a programming student going to learn how to use the “if statement” in 2 different
programming languages like C and Ada.
if (some condition)
//
Now consider the “if statement” in Ada programming language.