Select The Diploma in Information Technology (DIT) Papers

Computer Network 2nd Term 2021
Computer Network 2nd Term 2022
E- Commerce and Web Technology 1st Term 2019
Operating System 1st Term 2019
Computer Network 1st Term 2019
Computer Programming C/C++ 2019
Introduction to Data Base 2019
MS Access 1st Term 2019
Office Automation 1st Term 2019
Ms-Access DIT Part 2nd Exam 2013 2nd Term
Introduction to Data Base DIT Part 2nd Exam 2014 2nd term
Ms-Access DIT Part 2nd 1st Term examination 2013
Ms- Access DIT Part 2nd 1st Term Exam 2014
Introduction to Data Base DIT Part 2nd 1st Term Exam 2014
E-Commerce & Web Technology DIT part second 2nd Term 2013
E-Commerce & Web Technology DIT part second 1st Term 2013
E-Commerce & Web Technology DIT part second 2014
Operating System DIT Part First 2013
Operating System DIT Part First 2012
Solved exam papers of C/C++ DIT Part First Exam 1st Term 2013
Solved exam papers of C/C++ DIT Part First Exam 1st Term 2012
Solved exam papers of C/C++ DIT Part First Exam 2nd Term 2013
DIT Part 2nd Solved Exam paper of Graphic Designing
Solved exam papers of IT DIT part 1st Exam 2103
DIT Exam paper of E-Commerce and Web Designing 2014
DIT Exam paper of Data Base 2014
DIT Exam paper of MS Access 2014
DIT Exam paper of Graphic Design 2014
DIT(Part 1st) Solved Exam Paper 1st Term Exam 2012 IT
DIT(Part 1st) Solved Exam Paper 1st Term Exam 2012 IT
Exam Paper of Office Automation for DIT Part First 2013
Exam paper of Computer Networks for DIT Part First 2013
Exam paper of ICT DIT Part First 2013
Exam paper of C/C++ language DIT Part First 2013
Exam paper of Operating System DIT Part First 2013

Solved Exam Paper Of Computer Programming C/C++

DIT part 1st (1st Term Exam 2013)

Time Allowed: 3 Hours Max Marks=50

Note : Attempt any five question. All question carry equal marks.

Q1. Differentiate the following term with example ? (10) a) Variable declaration and variable definition
b) identifier , constant and variable
c) Operand , operator and expression

Answer:
a) Variable declaration and variable definition In computer programming we say that variable are those memory location, which are used to store the constant value. In C if want to use any variable then before every thing we must declare this variable. This declaration tell to complier about this variable and the types of data which is we are going to store in this variable.
 syntax:
data type Variable name;
Where data type is any valid data type in c for example int
Variable name is any valid variable name and value is optional .
When we declare the variable we are only talking about the name and its types but when we assign some memory to this variable this action is called variable definition. These two action some time occur at same time.
Int n (this is declaration )
N=20; This is definition of variable.
int n=20; these are both two action declaration and definition.

b) identifier , constant and variable Identifier:
In C language Identifiers are names given to C entities, such as variables, functions, structures etc.
For example:
int date;
In this declaration date is is a identifier.
constant:
A constant value is the one, which does not change during the execution of a program. C supports several types of constants.
1. Integer Constants
2. Real Constants
3. Single Character Constants
4. String Constants
Variable
In computer programming we say that variable are those memory location, which are used to store the constant value.
for example Int X;
hare x is an variable which can hold the integer data type.
c) Operand , operator and expression Operand:
Operand is collection of constant, variable . for example x+2 . hare x is any variable 2 is constant.
Operator:
Operator are special symbol that perform some special function like that addition, multiplication etc. For example +, -, /. are some arithmetic operator . In c we can use Arithimitic operator , relational operator, increment operator, assignment operator and logical operator
Expression: expression is collection of Operand and operator. If expression use Arithmetic operator then expression is called Arithmetic expression, if expression use logical operator then this is called logical expression. And if expression is used relational operator then this is called relational expression.

Q2. what will be the output of the following program segment explain the out put? (10)

Answer:

main()
{
int a=2,b=3,x,y;
floatw,z;
x=a/b*b;
y=b/a*a;
w=a/b*b;
z=b/a*a;
printf("%d %d %d %d",x,y,w,z);
getch();
}

The out will be 
0 2 0 0

Explanation:-
X=2/3 * 3 since x,a and b are integer so 2/3 will be 0 and when multiply by 0 it will become 0
Y=3/2 * a since y,a and b are integer 3/2 will be 1 and when multiply by 2 it become 2
W=2/3*3 since w is float so 2/3 will be 0 and when multiply by 2 it become 0
Z=3/2 *2 since z is float 3/2=1.0 and when multiply with 2 it become 2.0 but when printed with %d it will print 0

Q3. (a) What is decision control structure? Explain the IF and IF- Else statement with the help of example?
(b)Explain The Break Statement with Example?

Answer:
IF Statement
if statement is decision making statement or decision control statement in this statement we give a condition after using " IF " key word. If the condition is " True " then a statement or set of statements in the body of " IF " structure are executed and if the condition is "False? then nothing will be do and control is transfer to next statement according to sequences.
We say that if statement allows you to execute specific parts of a program if certain conditions are met (if condition is true)
If structure contain three main parts. The first is the keyword " if ". The second is an expression enclosed in parentheses (Condition). The third is the block of code (which is written in parentheses) that you want to run if the condition met to given condition.
Example

main( )
{
int n=7;
if(n>0)
printf("this is +ve number");
}

IF-Else Statement
If-Else statement is decision making statement or decision control statement in this statement we use two Keyword ? IF ? and ? ELSE ? we give a condition after using ? IF ? key word. If the condition is ?True ? then a statement or set of statements in the body of ? IF ? structure are executed and if the condition is "False? then statement or set of statement in the body of Else will be executed. ? We say that if statement allows you to execute specific parts of a program if certain conditions are met (if condition is true) .
Example: - Scan a number from user and display message that number that enter is +ve or -ve.

Main()
{
int n;
printf(?Enter a number \n?);
scanf(?%d? , &n ) ;
if(n>=0)
printf("number is +ve") ;
else
prinlf( ?Number is ?ve ") ;
getch( );
}

Break Statement:
When we want to jump out form the loop with out waiting to get back to test condition then we use Break statement.
Following program is best example to under stand the break statement.
main ( ) 
{
int i ;
clrscr( );
for (I =0 ; I<=100 ; I++)
{
if (i==50 )
break ;
printf(? %d? , I) ;
}
getch() ;
}

We see that in this program we use for loop to display the number 1 to 100 . but using break statement before the printf statement stopped the loop when counter reached to 50 and loop is terminated.

Q4. Write a c program to find the largest of 3 numbers using nested if statement? (10)

 Answer:

main()
{
Inta,b,c;
Clrscr();
Printf(?enter three numbers\n?);
Scanf(?%d %d %d?,&a,&b,&c);
If(a>b && a>c)
Printf(?largest number is %d?,a);
else
If(b>c)
printf(?largest number is %d?,b);
else
printf(?largest number is %d?,c);
getch();
}

Q5. What is Loop and Explain For loop with help of example? (10)

Answer:
Loop:
When we want to execute a statement or group of statement repeatedly then we useLoops. In simple word when we do some work again and again for specified period of time in the same way then we use loops. For example if we want to print message "hello C" 100 times then there are two ways to perform this type of task.
First we use printf statement 100 time to print this message on the screen.
Second we write single statement in the body of the loop which print this message 100 time.
So we observed that second one method is simple and easy and less time consuming.
In C language we have choice of three types of loop, for , while and do while .
These loop are classified in two types
 Count Control Loop
 Event control Loop
FOR LOOP
For loop is Count control loop. The for loop works well, where the number of iterations of the loop is known before the loop is entered. The head of the loop consists of three parts separated by semicolons.
The initial value: - This is usually the initialization of the loop variable and its initial
Value this variable is called Loop Counter.
Condition: -The second part is a test; the loop is terminated when this returns false.
Step: -
The third is a statement to be run every time the loop body is completed. This is usually an increment of the loop counter.

Example:
Following example give clear idea of using loop.
Main( )
{
int i ;
for(i=1 ; I<=100 ; i++) ;
printf( ? %d? , i) ; 
getch();
}

This Program print 1 to 100 digit on screen so we see that only one statement executed and 1 to 100 number print on the screen because of header of this statement is for loop which repeatedly execute the statement below which print the number.
in above example we see that if we enter 1(one) form keyboard then message appear that "You enter One" other wise condition is again tested end the result is prepared .

Q6. (a) What is preprocessor directive? Why we use # include preprocessor directive in the start of Program?
(b) What is header files? give some example of Header files are used in C/C++ language?

Answer:
Preprocessor Directive:
Preprocessor directives are those lines which are included in the code of programs preceded by a hash sign (#). These lines are not program statements but directives for the preprocessor. The preprocessor examines the code before actual compilation of code begins and resolves all these directives before any code is actually generated by regular statements. No semicolon (;) is expected at the end of a preprocessor directive. The only way a preprocessor directive can extend through more than one line is by preceding the newline character at the end of the line by a backslash (\).
For example
#include directive
# define directive
Header Files: In C header file is a file with extension .h. These files contains the function of C, declarations and macro definitions. These files are sharable so we can include thse files in our persional program. There are two types of header files: the files that the programmer writes and the files that come with your compiler. We can share these files by including it, with the C preprocessing directive #include.
For example
#include
When include header files its means that we add the code of these files in our personal file.
Syntax:
#include
#include "file"
Second syntax is used for our own header files.
Example of Header Files:
#include
#include

Q7. Explain the Following Operator with the help of example?
(a) compound assignment operator
(b) increment and decrement operator
(c) Conditional operator

Answer:
Compound Assignment Operator:
Compound assignment operators
The compound assignment operators consist of a binary operator and the simple assignment operator. They perform the operation of the binary operator on both operands and store the result of that operation into the left operand, which must be a modifiable value.
For example
a *= b + c
which is normally equal to a = a * (b + c)
Increment and Decrement Operator:
The increment and decrement operators are one of the unary operators, which are very useful in C language. They are extensively used in for and while loops.
The syntax of the operators is given below
1. ++ variable name
2. variable name++
3. - - variable name
4. variable name - -
The increment operator ++ adds the value 1 to the current value of operand and the decrement operator - -subtracts the value 1 from the current value of operand
Conditional Operator:
The conditional operator consists of 2 symbols the question mark (?) and the colon (:).
The syntax for a ternary operator is as follows
exp1 : exp2 : exp3
The ternary operator works as follows
exp1 is evaluated first. If the expression is true then exp2 is evaluated & its value becomes the value of the expression. If exp1 is false, exp3 is evaluated and its value becomes the value of the expression. Note that only one of the expression is evaluated.

Q8. Differentiate between following?
(a) Printf() and scanf()
(b) getch and putch()
(c) strlen() and strlwr
(d) pow() and sqrt()

Answer:
(a) Printf ( )and scanf( ):
Printf(): Printf allows formatted out put of data. Its arguments are, in order; it has some control string, which controls what gets printed, followed by a list of values to be substituted for entries in the control string. (It consists on format specifies and escape sequences).
Scanf ( ): Scanf is formatted input statement which is used to get the input form keyboard when program is run. It contain tow argument one is format specifer which tell to compiler that which type of data going to input and other is variable name ( with & sign) which store the data. for example scanf("%d" , &marks);
(b) getch ( )and putch( ):
Getch ( ): Getch stand for "Get character ". This function is used to get the single character From the user during the execution of program. When we input the character then its not display on the screen and control is transfer to next statement with out pressing enter key.
Syntax:
getch () Function:
Putch ( ): putch function is non formation function displays any alphanumeric characters to the standard output device. It displays only one character at a time.
for example
putch(variable_name);
(c) strlen ( )and strlwr( ):
strlen ( ):
The strlen function computes the length of the strings.
Syntax :
Strlen(String constant / string variable)
strlwr( );
strlwr() function converts all the uppercase characters in that string to lowercase characters. The resultant from strlwr() is stored in the same string.





View and Download More Papers !

Exam paper of Operating System DIT Part First 2013

Exam paper of C/C++ language DIT Part First 2013

Exam paper of ICT DIT Part First 2013

Exam paper of Computer Networks for DIT Part First 2013

Exam Paper of Office Automation for DIT Part First 2013

DIT(Part 1st) Solved Exam Paper 1st Term Exam 2012 IT

DIT(Part 1st) Solved Exam Paper 1st Term Exam 2012 IT

DIT Exam paper of Graphic Design 2014

DIT Exam paper of MS Access 2014

DIT Exam paper of Data Base 2014

DIT Exam paper of E-Commerce and Web Designing 2014

Solved exam papers of IT DIT part 1st Exam 2103

DIT Part 2nd Solved Exam paper of Graphic Designing

Solved exam papers of C/C++ DIT Part First Exam 2nd Term 2013

Solved exam papers of C/C++ DIT Part First Exam 1st Term 2012

Solved exam papers of C/C++ DIT Part First Exam 1st Term 2013

Operating System DIT Part First 2012

Operating System DIT Part First 2013

E-Commerce & Web Technology DIT part second 2014

E-Commerce & Web Technology DIT part second 1st Term 2013

E-Commerce & Web Technology DIT part second 2nd Term 2013

Introduction to Data Base DIT Part 2nd 1st Term Exam 2014

Ms- Access DIT Part 2nd 1st Term Exam 2014

Ms-Access DIT Part 2nd 1st Term examination 2013

Introduction to Data Base DIT Part 2nd Exam 2014 2nd term

Ms-Access DIT Part 2nd Exam 2013 2nd Term

Office Automation 1st Term 2019

MS Access 1st Term 2019

Introduction to Data Base 2019

Computer Programming C/C++ 2019

Computer Network 1st Term 2019

Operating System 1st Term 2019

E- Commerce and Web Technology 1st Term 2019

Computer Network 2nd Term 2022

Computer Network 2nd Term 2021