DIT part 1st (2nd Term Exam 2013)
Not:- Attempt any five question. All question carry equal marks:
Q1. State the structure of c/C++ program. (10)
Answer:
Basic structure of C/C++ program is:
pre-processor directives global declarations main( ) { local variables to function main ; statements associated with function main ; }
Basically every c program consist on diffident function but must have a main function which is called main( ). Every function have a set of variables and some statements. Each function start with opening curly brackets { and end wit closing curly brackets. Every statements terminate with semicolon ( ; ). C is case sensitive, that is, it recognizes a lower case letter and it's upper case equivalent as being different.
The description of the major parts of c program are
Preprocessor Commands:
These commands tells the compiler to do preprocessing before doing actual compilation. For example #include
Functions:
Each program have different function . Every C Program will have one or more functions but must have a function main( ) with its return data type.
Variables:
Every function have its own set of variable which store the numbers, string and other complex data for manipulation.
Statements & Expressions :
Every function have some statements which are the major instruction to computer to perform special task.
Comments:
Every statement may be followed by some comments which store the additional information of the work .
Q2. a) What is C/ C++ data types? (03)
Answer:
Data type is a classification of the data that a variable or object can hold in computer programming. Data types are very important part of computer programming. C/C++ also have some predefine data types which can hold the languages, number , character and other values. User can also define its own data type which is called user define data type.
C and C++ have a number of basic data types. Each have specific uses and advantages, depending on the application. Generally in C language the data types divided into two major categories Integer types and Floating Point types.
Where Integer types consist on bool, char, short, int, long, and Floating Point types consist on float double and long double
(b) Explain the following: (07)
i) Bollen
ii) Chatacter
iii) Integer
Bollen: This allows store the two number o and 1. bollen data type only use in C++.
Char: This data type store the one character which can take place 1byte of the computer memory.
Integer : This data type can hold the number and take place the 2 to 4 byte of computer memory and can store
the value 32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
Q3. (a) What do you means by character constant ? give some example? (5)
Answer:
Character Constant
Some time also called Single Character constant represent a single character which is enclosed in a pair of quotation symbols.
Example for character constants are
'5' , 'x' , ';' , ' '
Q4. (a) Define and explain the variable ? (05)
(b) Define and explain the variable ? (05)
Answer:
A variable is a value that can change any time. In computer programming we say that variable are those memory location, which are used to store the constant value. The programmer should carefully choose a variable name so that its use is reflected in a useful way in the entire program. Variable names are case sensitive.
Example of variable names are
Sun , number , Salary , Emp_name
average1
Any variable declared in a program should confirm to the following Rules:
1. They must always begin with a letter, although some systems permit underscore as the first character.
2. The length of a variable must not be more than 8 characters.
3. White space is not allowed and
4. A variable should not be a Keyword
5. It should not contain any special characters.
Q5. Write the purpose of the following function? (10)
get( )
put( )
getch( )
putch( )
gets( )
Answer:
gets( ) function:
Gets reads a whole string until new line is encountered. When all input is finished (when enter key is pressed) a NULL character is append at the end of the string, which shows end of the string input.
Syntax:
gets (variable 1, variable2...) Where variable is any string type variable
puts () Function:
This function is used to print the string values on screen. When output of string is over, then a new line is inserted automatically.
Syntax:
puts(variable name or string constant)
getch () Function:
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);
Q6. State about output using cout and input using cin by giving one example (10)
Answer:
Cout :-
cout is standard output stream. The << operator inserts the data that follows it into the stream that precedes it
for example
cout<< "Output sentence"; // prints Output sentence on screen cout<< 120; // prints number 120 on screen cout<< x; // prints the value of x on screen
int age; cin>> age;
#include#include void main (void) { int a; cout<< "Please enter an integer value: "; cin>> a; cout<< "The value you entered is " << a; getch(); }
Q7. (a) What is Do while loop. Explain with example (05)
(b) What is break statement? Give an example (05)
Answer:
Do While Loop:
The do while construct consists of a block of code and a condition. First, the code within the block is executed, and then the condition is evaluated. If the condition is true the code within the block is executed again. This repeats until the condition becomes false. Because do while loops check the condition after the block is executed, the control structure is often also known as a post-test loop. Contrast with the while loop, which tests the condition before the code within the block is executed.
The do while loops is similar to while loop, but the test occurs after the loop body is executed. This ensures that the loop body is run at least once.
Syntax: -
Do { statement 1 ; statement 2 ; statement 3 ; } Example: Example: - Main() { int x = 11 ; do { printf(" %d \n", x); } while (x <= 10) ; getch( ); }
Main ( ) { int i ; clrscr( ); for (I =0 ; I<=100 ; I++) { if (i==50 ) break ; printf(? %d? , I) ; } getch() ; }
Q8. (a) What does relational operator Do? List the diffirent Types? (05)
(b) Write a C++ program to print first ten numbers ? (05)
Relational Operators and its types: -
Relational operator is required to compare the relationship between operands (Constant/variable/expression) and bring out a decision. C supports the following relational operators.
< Less than <= Less than or equal to > Greater than >= Greater than or equal to == Equal to ! = Not equal to
6.5 <= 25 TRUE -65 > 0 FALSE 10 < 7 + 5 TRUE
#include#include void main (void) { inti; for(i=1;i<=10;i++) cout<
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