Algol to Traditional C & Basics of C Programming
A. Multiple Choice Questions (20)
-
Algol was mainly used for:
(a) Web Development
(b) Scientific Computations
(c) Gaming
(d) Mobile Apps
Ans:- (b) Scientific Computations -
Which language influenced many modern programming languages?
(a) Java
(b) Algol
(c) Python
(d) HTML
Ans:- (b) Algol -
Who developed BCPL?
(a) Ken Thompson
(b) Dennis Ritchie
(c) Martin Richards
(d) Brian Kernighan
Ans:- (c) Martin Richards -
The B language was developed for which operating system?
(a) Windows
(b) Linux
(c) UNIX
(d) Android
Ans:- (c) UNIX -
Who invented the C language?
(a) Ken Thompson
(b) Dennis Ritchie
(c) Martin Richards
(d) Bill Gates
Ans:- (b) Dennis Ritchie -
In which year was C developed?
(a) 1966
(b) 1969
(c) 1972
(d) 1978
Ans:- (c) 1972 -
The famous book “The C Programming Language” was co-authored by:
(a) Ritchie & Richards
(b) Thompson & Ritchie
(c) Kernighan & Ritchie
(d) Kernighan & Richards
Ans:- (c) Kernighan & Ritchie -
Traditional C is also called:
(a) K&R C
(b) ANSI C
(c) Turbo C
(d) Modern C
Ans:- (a) K&R C -
Which is NOT an advantage of C?
(a) Fast and Efficient
(b) Object-Oriented
(c) Close to Hardware
(d) Portable
Ans:- (b) Object-Oriented -
Which of the following is a disadvantage of C?
(a) Fast execution
(b) Secure data handling
(c) Manual memory management
(d) Structured programming
Ans:- (c) Manual memory management -
POP stands for:
(a) Program Oriented Programming
(b) Process Oriented Programming
(c) Procedure Oriented Programming
(d) Processor Operating Program
Ans:- (c) Procedure Oriented Programming -
Which language is an example of OOP?
(a) C
(b) Pascal
(c) FORTRAN
(d) Java
Ans:- (d) Java -
In OOP, data and functions are kept:
(a) Separate
(b) Together in objects
(c) Only in functions
(d) Only in data
Ans:- (b) Together in objects -
Which of the following is NOT a keyword in C?
(a) int
(b) return
(c) name
(d) while
Ans:- (c) name -
Which of these identifiers is valid?
(a) 1total
(b) total_marks
(c) int
(d) return
Ans:- (b) total_marks -
Range of char in C is:
(a) 0 to 255
(b) -128 to 127
(c) -32768 to 32767
(d) None
Ans:- (b) -128 to 127 -
Which operator is used for modulus (remainder)?
(a) %
(b) /
(c) *
(d) &
Ans:- (a) % -
Which operator checks equality in C?
(a) =
(b) ==
(c) !=
(d) <=
Ans:- (b) == -
sizeof operator in C is used to find:
(a) Variable value
(b) Data type size
(c) Program size
(d) Number of variables
Ans:- (b) Data type size -
Which is a Null Statement in C?
(a) { }
(b) ;
(c) return 0;
(d) #include<stdio.h>
Ans:- (b) ;
B. Very Short Answer Questions (10)
-
What does Algol stand for?
Ans:- Algorithmic Language -
Who developed the B language?
Ans:- Ken Thompson -
In which year was BCPL created?
Ans:- 1966 -
What is Traditional C also known as?
Ans:- K&R C (Kernighan & Ritchie C) -
Name the co-authors of “The C Programming Language”.
Ans:- Dennis Ritchie and Brian Kernighan -
Which feature of C makes it close to hardware?
Ans:- Direct memory access / pointer support -
What does OOP stand for?
Ans:- Object-Oriented Programming -
Give one example of POP language.
Ans:- C language -
How many keywords are there in C?
Ans:- 32 keywords -
What is an identifier in C?
Ans:- A name given to variables, functions, or arrays in a program.
C. Short Answer Questions (10)
-
State one importance of Algol.
Ans:- Algol laid the foundation for structured programming and influenced many modern programming languages like C, Pascal, and Java. -
Explain the role of BCPL in C’s development.
Ans:- BCPL was a simple and powerful system programming language created by Martin Richards. It directly influenced the design of B language, which later evolved into C. -
Why was B language considered limited?
Ans:- B language lacked data types and other advanced features, making it less powerful and less efficient for large system programming. -
List two advantages of C language.
Ans:- (i) It is fast and efficient. (ii) It is portable and can run on different systems easily. -
Write two disadvantages of C language.
Ans:- (i) It is not object-oriented. (ii) It requires manual memory management, which may lead to errors. -
Differentiate between POP and OOP in terms of data security.
Ans:- In POP, data is not secure because functions and data are separate. In OOP, data is secure as it is combined with functions inside objects (encapsulation). -
Write rules for naming identifiers in C.
Ans:- Identifiers must start with a letter or underscore, can contain letters, digits, and underscores, cannot be a keyword, and are case-sensitive. -
What are the three main categories of C data types?
Ans:- (i) Primary (Fundamental) data types, (ii) User-defined data types, (iii) Derived data types. -
Define an operator with one example.
Ans:- An operator is a symbol used to perform operations on data. Example:+
is an operator,5+3=8
. -
What does the conditional (ternary) operator do in C?
Ans:- It provides a shorthand for if-else statements. Example:max = (a > b) ? a : b;
.
D. Long Answer Questions (5)
-
Describe the historical development of the C language from Algol to Traditional C.
Ans:- Algol was developed in the 1950s for scientific computations and introduced structured programming. In 1966, Martin Richards created BCPL, which influenced system-level programming. In 1969, Ken Thompson developed the B language for UNIX, but it was limited. In 1972, Dennis Ritchie developed the C language at Bell Labs by improving B. In 1978, the first standard version of C was documented in the book “The C Programming Language” by Kernighan and Ritchie, which became known as Traditional C. -
Explain the difference between Procedure-Oriented Programming (POP) and Object-Oriented Programming (OOP) with features.
Ans:- POP is based on dividing a program into functions and focuses on process/logic. Data is separate from functions, making it less secure. Examples: C, Pascal. OOP is based on objects, where data and functions are combined. It provides features like encapsulation, inheritance, and code reusability. Examples: C++, Java. POP is traditional, while OOP is modern and suitable for complex applications. -
Discuss the advantages and disadvantages of C language in detail.
Ans:- Advantages: (i) C is fast and efficient. (ii) Portable and suitable for system programming. (iii) Structured programming makes coding easy. (iv) Good foundation for other languages. Disadvantages: (i) Not object-oriented. (ii) Manual memory management makes it less secure. (iii) No built-in GUI support. (iv) Error handling is difficult compared to modern languages. -
Write a note on data types in C with examples of primary, user-defined, and derived types.
Ans:- C supports three categories of data types. Primary types include int, char, float, double, etc. Example:int age = 20;
. User-defined types include struct, union, enum, and typedef, created by programmers. Example:struct student { int roll; char name[20]; };
. Derived types are created from fundamental types, such as arrays, pointers, and functions. Example:int arr[5];
(array),int *p;
(pointer). These types make C flexible for programming. -
Explain the different types of operators in C with suitable examples.
**Ans:- C operators are:
(i) Arithmetic operators (+, -, , /, %). Example:a+b
.
(ii) Relational operators (==, !=, >, <, >=, <=). Example:a>b
.
(iii) Logical operators (&&, ||, !). Example:a>5 && b<10
.
(iv) Assignment operators (=, +=, -=, =, /=). Example:a+=5
.
(v) Increment/Decrement operators (++ and --). Example:a++
.
(vi) Bitwise operators (&, |, ^, ~, <<, >>). Example:a & b
.
(vii) Conditional (?:). Example:(a>b)?a:b
.
(viii) sizeof operator. Example:sizeof(int)
.
These operators make C powerful and versatile for calculations and logic building.
No comments:
Post a Comment