Professional Documents
Culture Documents
ITP Short Answer Questions (AutoRecovered)
ITP Short Answer Questions (AutoRecovered)
ITP Short Answer Questions (AutoRecovered)
Unit-1
1. List the different types of C tokens?
Ans: Tokens are the smallest units in the source code that are meaningful to the compiler. There are
six types of tokens in C.
Keywords
Identifiers
Constants
String Literals
Operators
Punctuation Symbols
4. Is there any difference between pre increment and post increment? Explain with
examples?
Ans: Yes, pre-increment and post-increment are two different ways of incrementing a variable in
programming. The key difference is in the order of operations: pre-increment increments the variable
first, while post-increment uses the current value before incrementing.
Example:
1. Pre-increment 2. Post-increment
Int a=5; int c=5;
Int b=++a; int d=a++;
// Now a = 6, b = 6 // Now c =6 , d = 5
Unit-II
1. What is break statement?
Ans: In programming, the break statement is a control flow statement that is used to terminate the
execution of a loop prematurely, causing the program to exit the loop even if the loop condition is
still true. The break statement is commonly associated with loops (such as for and while loops), but
it can also be used in switch statements.
Unit -3
1.What is string constant?
Ans: A string constant in programming refers to a sequence of characters enclosed within
double quotation marks. It is a way to represent textual data, such as words, sentences, or any
combination of characters.
Example:
const char *myString = "Hello, World!";
In this example:
"Hello, World!" is a string constant.
Unit-5
1. Discuss about the keyword Register with examples?
Ans:
In C, the register keyword is used as a hint to the compiler that a particular variable should be
stored in a register for faster access.
Example:
Aim: C program for register keyword usage
Source Code:
#include <stdio.h>
int main()
{
register int x; // Declare x as a register variable
int y;
// Assign values
x = 5;
y = 10;
Formal parameters : They are used in the function definition to accept the values from the
caller of the function. Formal parameters can be of any data type such as int, float, char, etc.
Syntax :
return_type function_name(parameter1_type parameter1_name, parameter2_type
parameter2_name, ... )
{
// function body
}