Unit2 2marks
Unit2 2marks
2 Marks:
1. Define problem solving & formulation.
⮚ Problem formulation is an iterative process that involves decomposition of analytic problem `
into appropriate dimensions such as structures, functions, and mission media.
⮚ In problem solving, it is important to understand what the problem & need to read the
problem statement in a number of times.
2. Write any four Escape sequence in c.
Execution character set are always represented by back slash followed by a character is called as
Escape sequence.
\n- new line
\b- Backspace
\0-Null
\v-Vertical tab
3. What are the features of C language?
⮚ C is a general purpose; structure programming language.It is a fast and efficient
⮚ It is a middle level language & Highly portable
10. Define variables and Constants./ Difference between variables and Constants
⮚ A variable is an identifier that is used to represent some specified type of
information within a designed portion of the program.
⮚ The items whose values cannot be changed during the execution of program are called
constants.
16. What are the types of user defined variables? Give their syntax.
a) Type Declaration:
Syntax:typedef data_type identifiers;
b) Enumerated data types:
Syntax: enum identifier {value1,value2,……valuen};
20. What is the difference between logical AND & Bitwise AND?
Logical AND(&&): Only used in conjunction with two expression, to test more than one condition.
If both condition are true their returns 1. If false then return 0.
Bitwise AND(&): Only used in bitwise manipulation. It is a unary operator.
21. List any four shorthand assignment operator.
+=
-=
*=
/=
23. Convert the following if statement into conditional expression using ternary operator
if(a>b)
big = a;
else big = b;
sc gets()
anf()
In scanf() when there is a blank was gets() assumes the enter key as end.
typed, the scanf() assumes that it is an
end. gets() gets a new line(\n) terminated string of
characters from the keyboard and replaces the ‘\n’
with ‘\0’
30. Differentiate between getchar and scanf functions for reading strings.[MAY/JUNE2005]
getchar() scanf()
1. A single character can be given to the 1.Input data can be entered in to the
computer using ‘C’ input library function computer using the standard input ‘C’
getchar(). library function called scanf()
2. The function do not require any 2.scanf() function starts with a string
arguments, through a pair of empty argument and may contain additional
parantheses,through a pair of empty arguments.
paranthses, must follow the statement
getchar(). 3. It is formatted I/O statement
3. It is unformatted I/O statement
32. What is scope of variable & list the two types of scope of variable?
Scope of variable implies the availability of variables with in a program.
Two types: Local variable
Global variable.
33. What is the significance of while statement in C. Give typical format of it.
⮚ It is a repetitive control structure used to execute the statements within the body
until the condition become false. It is also an entry controlled loop statement.
While(condition)
{
-- Body of the loop;---
}
34. Comparision between while & do while statements?
while Do-while
This is the top tested loop This is the bottom tested loop
Condition is 1st tested, if true block is Executed the body once, executes until the
executed until the condition becomes false condition becomes false.
Loop will not be executed if the condition is Al least once the loop is executed when if the
false. condition is false.
1. Explain the structure of ‘C’ program and explain with their example.
2. Define c tokens and explain with their types.
3. Explain various data types with examples.
4. What are the various types of operators supported by C? Describe each with a
suitable example.[JAN2006][JAN2005]
5. Differentiate between operator & operand. What are the various types of
operators.[MAY2005]
6. Explain in detail of
a) Formatted I/O statements
b) Unformatted I/O statements
7. Explain the control statements in detail.
8. Write a program to determine whether the given number is odd or even.
9. Explain
i) The while loop ii) Do
while loop
10. Explain i) For loop ii)Nesting of for loops
11. explain in detail about the loop structures in ‘C’?
12. Compare in terms of their functions while & do while loop with an example?
[UN Q]
13. Write a ‘C’ program to find the greatest of given 10
numbers?[UNQ]