DIT Past Papers
Paper: Computer Programming
Compiled By: Engr. Jamal khan
Paper: 2012
Q.1:-State the structure of a C / C++ program.
Q.2:-What are C/C++ data types?
Explain the following data types also write how they are declared.
i) Boolean type
ii) Character type
iii) Integer type
Q.3:-a)What do you mean by character constant? Give one example.
b)What is 3 string constant? Explain with the help of one example.
Q.4:-a)Define and explain Variable.
b)Write the rules for constructing variable names.
Q.5:-Write the purpose of the following functions in one line.
a) get ( ) function
b) put ( ) function
c) getch ( ) function
d) putch ( ) function
e) gets ( ) function
Q.6: -State about output using cout and input using cin by giving one example.
Q.7: – a) What is a Do-While loop. Explain with the help of an example.
b) What is a break statement? Give one example.
Q.8:- a) What does relational operator do, list its different types.
b) Write a C++ program to print first ten numbers.
Paper 2013:
Q.1:- Differentiate the following terms with suitable examples.
1. Variable Declaration and Variable Definition.
2. Identifier, Constant and Variable
3. Operands, Operators and Expression
Q.2:- What will be the output of the following program segment. Explain the output.
main ()
{
int a=2, b=3, x, y;
float w, z;
x= a/b * b;
y = b/a * a;
w = a/b *b;
z = b/a * a;
printf( “%d%d %f %f *, a.b,w,z);
}
Q.3:- a) What is decision control structure ? Explain the if statement and if-else statement with
the help of an example.
b) Explain Break statement with example.
Q.4:-Write a program which find and Print the largest of three numbers by using nested IF
statement.
Q5:- a)What is loop? Explain For Loop with the help of an example.
b) What will be the output of the following program segment.
main ( )
{
int i;
For (i=l;i <=5; printf (“ln%d”, i))
i++;
}
Q.6:- a) What is Preprocessor Directive? Why we use # include Preprocessor Directive in the
start of program?
b) What is Header file? Give some examples of Header files are used in C/C++ Language.
Q.7:-Explain the following operators with the help of an example.
a) Compound Assignment Operators.
b) Increment & Decrement Operators.
c) Conditional Operator.
Q.8:-Differentiate the following built-in functions.
a) Printf () and Scanf ()
b) geleh () and Putch ()
c) Puts () and gels ()
d) Strlen () and Strlwr ()
e) Pow () and Sqrt ()
Paper : 2014
Q1:- Differentiate any five pairs from given.
i) Signed and unsigned integer
ii) STRLWR () and STRUPRO)
iii) Break and continue statement
iv) Prefix and postfix operator
v) execution time value assignment and run time value assignment
Q2: Write short notes on any two from the following with example
1) for loop
2) processor directive
3) arithmetic functions
Q3: Write body structure for any five from the given
i) NESTOD if-else statement
ii) while loop
iii) GOTO statement
iv) declaration of user defined function
v) print
vi) C/C++ program structure
Q4: Write output for any four from given logics.
i) int a=5, b=10;
printf(=b%a5%d/n”, b%a);
ii) int n= 10
char=”*”
printf(“%d”,ch)
printf (%c”,chi);
iii) int I,j ;
for (i=1;i<5;i++)
for(j=1;j<= 1,391)
Printf(“*”);
Printf (“n”)
iv) printf(“%f’, ceil(9.9);
v) printf(“%”, pow (5,2));
Part-B
Q5: Write program that take a numb3er from user and show whether it is odd or even using if-
else statement
Q6: Elaborate while and do while loop in detail with one example.
Q7: Elaborate user defined words and reserve words with examples
Q8: Elaborate input and output statements. Also write down two functions of each statement.
Paper : 2015
Q1:- Differentiate any five pairs from given.
i) Signed and unsigned integer
ii) STRLWR () and STRUPRO)
iii) Break and continue statement
iv) Prefix and postfix operator
v) execution time value assignment and run time value assignment
Q2: Write short notes on any two from the following with example
1) for loop
2) processor directive
3) arithmetic functions
Q3: Write body structure for any five from the given
i) NESTOD if-else statement
ii) while loop
iii) GOTO statement
iv) declaration of user defined function
v) print
vi) C/C++ program structure
Q4: Write output for any four from given logics.
i) int a=5, b=10;
printf(=b%a5%d/n”, b%a);
ii) int n= 10
char=”*”
printf(“%d”,ch)
printf (%c”,chi);
iii) int I,j ;
for (i=1;i<5;i++)
for(j=1;j<= 1,391)
Printf(“*”);
Printf (“n”)
iv) printf(“%f’, ceil(9.9);
v) printf(“%”, pow (5,2));
Part-B
Q5: Write program that take a numb3er from user and show whether it is odd or even using if-
else statement
Q6: Elaborate while and do while loop in detail with one example.
Q7: Elaborate user defined words and reserve words with examples
Q8: Elaborate input and output statements. Also write down two functions of each statement.
Paper : 2019
Q1. Explain C is considered to be a remarkable and powerful tool for programming. Also
elaborate on the benefits of object-oriented programming.
Q2. What are reserved words? Explain its usage with the help of programing example.
Q3. Write a C program to print first ten natural number from 10 to 1 in descending order starting
from 10, Using decrement operator without using loop.
Q4. Write a program to print size of int, flout, double, char and bool data types on separate line
using print function.
Q5. Write a program to assign five different numbers to integer variables without appearing the
entered number on the screen (Hint: use getch function)
Q6. Wat are relational operators? Write a C Program to check if an entered number is divisible
by 4 and 6 using nested if statement.
Q7. What is the condition which leads to the use of continue statement in loops? Support your
answer with a C programming example.
Q8. What are library function? Write a C program to solve = √[(x2+y2) using sqrt () function let
x=3 and y=4

Computer Programming Past papers for DIT

  • 1.
    DIT Past Papers Paper:Computer Programming Compiled By: Engr. Jamal khan Paper: 2012 Q.1:-State the structure of a C / C++ program. Q.2:-What are C/C++ data types? Explain the following data types also write how they are declared. i) Boolean type ii) Character type iii) Integer type Q.3:-a)What do you mean by character constant? Give one example. b)What is 3 string constant? Explain with the help of one example. Q.4:-a)Define and explain Variable. b)Write the rules for constructing variable names. Q.5:-Write the purpose of the following functions in one line. a) get ( ) function b) put ( ) function c) getch ( ) function d) putch ( ) function e) gets ( ) function Q.6: -State about output using cout and input using cin by giving one example. Q.7: – a) What is a Do-While loop. Explain with the help of an example. b) What is a break statement? Give one example. Q.8:- a) What does relational operator do, list its different types. b) Write a C++ program to print first ten numbers. Paper 2013: Q.1:- Differentiate the following terms with suitable examples.
  • 2.
    1. Variable Declarationand Variable Definition. 2. Identifier, Constant and Variable 3. Operands, Operators and Expression Q.2:- What will be the output of the following program segment. Explain the output. main () { int a=2, b=3, x, y; float w, z; x= a/b * b; y = b/a * a; w = a/b *b; z = b/a * a; printf( “%d%d %f %f *, a.b,w,z); } Q.3:- a) What is decision control structure ? Explain the if statement and if-else statement with the help of an example. b) Explain Break statement with example. Q.4:-Write a program which find and Print the largest of three numbers by using nested IF statement. Q5:- a)What is loop? Explain For Loop with the help of an example. b) What will be the output of the following program segment. main ( ) { int i; For (i=l;i <=5; printf (“ln%d”, i))
  • 3.
    i++; } Q.6:- a) Whatis Preprocessor Directive? Why we use # include Preprocessor Directive in the start of program? b) What is Header file? Give some examples of Header files are used in C/C++ Language. Q.7:-Explain the following operators with the help of an example. a) Compound Assignment Operators. b) Increment & Decrement Operators. c) Conditional Operator. Q.8:-Differentiate the following built-in functions. a) Printf () and Scanf () b) geleh () and Putch () c) Puts () and gels () d) Strlen () and Strlwr () e) Pow () and Sqrt () Paper : 2014 Q1:- Differentiate any five pairs from given. i) Signed and unsigned integer ii) STRLWR () and STRUPRO) iii) Break and continue statement iv) Prefix and postfix operator v) execution time value assignment and run time value assignment Q2: Write short notes on any two from the following with example 1) for loop 2) processor directive 3) arithmetic functions Q3: Write body structure for any five from the given
  • 4.
    i) NESTOD if-elsestatement ii) while loop iii) GOTO statement iv) declaration of user defined function v) print vi) C/C++ program structure Q4: Write output for any four from given logics. i) int a=5, b=10; printf(=b%a5%d/n”, b%a); ii) int n= 10 char=”*” printf(“%d”,ch) printf (%c”,chi); iii) int I,j ; for (i=1;i<5;i++) for(j=1;j<= 1,391) Printf(“*”); Printf (“n”) iv) printf(“%f’, ceil(9.9); v) printf(“%”, pow (5,2)); Part-B Q5: Write program that take a numb3er from user and show whether it is odd or even using if- else statement Q6: Elaborate while and do while loop in detail with one example. Q7: Elaborate user defined words and reserve words with examples Q8: Elaborate input and output statements. Also write down two functions of each statement. Paper : 2015 Q1:- Differentiate any five pairs from given. i) Signed and unsigned integer ii) STRLWR () and STRUPRO) iii) Break and continue statement iv) Prefix and postfix operator v) execution time value assignment and run time value assignment Q2: Write short notes on any two from the following with example 1) for loop 2) processor directive 3) arithmetic functions
  • 5.
    Q3: Write bodystructure for any five from the given i) NESTOD if-else statement ii) while loop iii) GOTO statement iv) declaration of user defined function v) print vi) C/C++ program structure Q4: Write output for any four from given logics. i) int a=5, b=10; printf(=b%a5%d/n”, b%a); ii) int n= 10 char=”*” printf(“%d”,ch) printf (%c”,chi); iii) int I,j ; for (i=1;i<5;i++) for(j=1;j<= 1,391) Printf(“*”); Printf (“n”) iv) printf(“%f’, ceil(9.9); v) printf(“%”, pow (5,2)); Part-B Q5: Write program that take a numb3er from user and show whether it is odd or even using if- else statement Q6: Elaborate while and do while loop in detail with one example. Q7: Elaborate user defined words and reserve words with examples Q8: Elaborate input and output statements. Also write down two functions of each statement. Paper : 2019 Q1. Explain C is considered to be a remarkable and powerful tool for programming. Also elaborate on the benefits of object-oriented programming. Q2. What are reserved words? Explain its usage with the help of programing example. Q3. Write a C program to print first ten natural number from 10 to 1 in descending order starting from 10, Using decrement operator without using loop. Q4. Write a program to print size of int, flout, double, char and bool data types on separate line using print function.
  • 6.
    Q5. Write aprogram to assign five different numbers to integer variables without appearing the entered number on the screen (Hint: use getch function) Q6. Wat are relational operators? Write a C Program to check if an entered number is divisible by 4 and 6 using nested if statement. Q7. What is the condition which leads to the use of continue statement in loops? Support your answer with a C programming example. Q8. What are library function? Write a C program to solve = √[(x2+y2) using sqrt () function let x=3 and y=4