PSPC Faq For Internal Exam
PSPC Faq For Internal Exam
PSPC Faq For Internal Exam
PART - A
1. What are the functionalities played by the declaration of variables?
Variable tells the compiler that
what the variable name is.
what type of data the variable will hold.
1
Symbol used in flowchart listed below:
2
7. Define data types and classify them
Data types are required when you declare variables in C. data type indicates
what type of data that can be stored in that variable .
Variables can be broadly classified into the following:
3
9. Explain void types?
The void data type does not store values. So, we don’t declare variables of void
data type. It is only used in the function definition to indicate that the function
does not return any value to the calling program or function does not accept any
input from function call
Example:
void show(void)
{
printf(“welcome”);
}
logical Operators are used to concatenate the result of more than one relational
expressions. logical operators includes the following:
o logical AND - &&
o logical OR - ||
o logical not - !
4
A=2 * 3 + 4 % 5 – 3 / 2.0 + 6 ;
14. Define variable. Summarize the rules and guide lines for naming variable
Variable is nothing but the name of a memory location in that we can store some data
Variables are declared to store some value within it.
example:
int a, b, c=10;
float balance,mark1, mark2;
char ch=’Y’;
guide lines for naming variable are listed below:
The first character of an variable must be alphabet (or) underscore
subsequent character could be either letters, digits (or) underscore
Any other special character will not be allowed, including space
variables are case sensitive, for example variables sum,SUM,SuM are treated as
three different variables
Length of the variable can be up to 31 characters
C keywords or reserved words cannot be used as identifier
17. Write a C program to print an array of ‘n’ numbers using the for loop.
int main()
{
float weight[10]={50,76.6,45.3,60,77};
int i;
for(i = 0; i<5; i++)
printf("%f\n", weight[i]);
5
}
18. List out the various string operations in ‘C’.
various string operations are listed below:
finding length of the given string
concatenate one string with another
copy one string into another
extracting substring from the given string
searching substring in the given string
find and replace substring in the given string
6
• Where StorageClass is optional and size could be any positive integers, but cannot be
negative
• Example:
int A[20];
static float marks[5];
• Similarly, A two dimensional array can be declared using following syntax:
• Example:
int x [3] [3];
char namelist[50][25];
• Example
int A[20]; //1D integer array can store maximum of 20 elements
char namelist[50][25]; //2D integer array can store maximum of 50 string having
maximum length of 25 character