Elements of C Short Questions and Answers


Elements of C Questions and Answers. This is the 1st post about 2nd Year | ICS Part-II Computer Science Chapter No.9: (Elements of C) | Short Questions and Answers.

 

The following objective questions are very important for the final examinations of all Boards of Punjab as well as Pakistan.


Elements of C Short Questions and Answers


Chapter No.9: Elements of C

Short Questions and Answers - 1


Q.1: Define identifiers?
 
Answer:
 
Identifiers are the names used to represent variables, constants, types, functions, and labels in the program. Identifiers in C can contain any number of characters, but only the first 31 are significant to C compiler. There are two types of identifiers in C:
  1. Standard identifiers
  2. User-defined identifier
 
Q.2: What are the standard identifiers?
 
Answer:
 
Like reserved words, standard identifiers have special meanings in C, but these can be redefined to use in the program for other purposes, however, it is not recommended. Examples of standard identifiers include printf and scanf.
 
Q.3: What are user-defined identifiers?
 
Answer:
 
The programmer may need to access memory locations for storing data and program results. For this purpose, memory cells are named that are called user-defined identifiers.
  
Q.4: What is meant by case-sensitive language?
 
Answer:
 
This means that C compiler considers uppercase and lowercase letters to be distinct characters. For example, the compiler considers Area and area as two different identifiers referring to different memory locations.
 
Q.5: What are the keywords?
 
Answer:
 
Keywords or reserved words are the words, which have predefined meaning in C. There are 32 keywords in C. These cannot be reused or redefined for any other purpose in a C program. They are used by the compiler as an aid to compile the program. They are always written in lowercase.
 
Q.6: What is meant by strongly typed language?
 
Answer:
 
Strongly typed language means that variables in C language must be declared before using them.
 
Q.7: What are the variables?
 
Answer:
 
Variables are named memory locations which are used to store the program’s input data and its computational results during program execution. The value of the variable may change during the program execution. These are created in RAM, therefore the data is stored in them temporarily.
 
Q.8: What is meant by declaring a variable in C?
 
Answer:
 
Variable declaring means to inform the compiler about the name of the variable and the type of data to be stored in it. A variable is declared in C by specifying its type (data type) and name.

Syntax:        data-type    variable_name;
Example:      int     area;
 
Q.9: What is defining a variable?
 
Answer:
 
A variable defining means to set aside memory location for the data to be stored. It occupies the memory location for the variable to store value.
 
Q.10: What is initializing a variable?
 
Answer:
 
Assigning a value to a variable at the time of its declaration is called initializing a variable. By default, the allocated memory space may contain data meaningless to the program (called garbage).
 
Example:
int count; (variable declaration and definition)
count = 25; (variable initialization)
 
Q.11: What is constant?
 
Answer:
 
A constant is a quantity whose value cannot be changed during program execution. The define directive can be used to define constant macros, for example:
#define PI            3.142857
 
Q.12: Define numeric constant?
 
Answer:

Numeric constants consist of numbers. It can be further divided into integer and floating-point constants. Integer constants do not have a fractional part e.g. +55, -70, etc.
Floating-point constants represent values that are measured e.g. -5.50, 0.78 etc.
 
Q.13: What is a character constant?
 
Answer:
 
A character constant is a single alphabet, a single digit, or a single symbol enclosed within apostrophes e.g. ‘A’, ‘7’ and ‘#’ etc. The maximum length of a character constant is 1 character.
 
Q.14: What is the data type?
 
Answer:
 
The data type defines a set of values and a set of operations on those values. The data is given to the program (variable) as input. The data is processed according to the program instruction and output is returned e.g. int, float, and char, etc.
 
Q.15: Define standard data types?
 
Answer:
 
C provides different types of predefined data types to declare and store data values into variables such as int, float, double, and char etc
.


➤ Elements of C - Short Questions Set-II
➤ Elements of C - Short Questions Set-III
➤ Elements of C - MCQs
➤ Getting Started With C - Short Questions
➤ Getting Started With C - MCQs
➤ Input/Output - MCQs | Quiz
➤ Input/Output - Short Questions
➤ Input/Output - Exercise Programs

Post a Comment

Your feedback is highly appreciated and will help us to improve. So, please give your good suggestions.

Previous Post Next Post