Latest News
|
|
UNIT 1
TOPICS TO BE COVERED IN THIS UNIT:
- Algorithm / pseudo code
- Flowchart
- Program development steps
- Structure of C program
- A Simple C program
- Identifiers
- Basic data types and sizes
- Constants and Variables
- Operators:- Conditional, Arithmetic, Logical, Increment and Decrement, Bit-wise, Relational, Assignment, Special Operators
- Expressions and Type conversions
- Conditional Expressions
- Precedence and Order of Evaluation.
- Input-output statements
- Statements and Blocks
- if and switch statements
- Loops- while, do-while and for statements
- break, continue, goto and labels
TEACHING MATERIAL
Unit 1 Teaching Aids - Click Here
TUTORIAL MATERIAL
Tutorial 1
- Give the pictorial representation of different symbols used in flowchart and when it is used?
- Write an algorithm/ pseudo code for multiplication of three given numbers?
- Write an algorithm for given problems.
- Calculate the simple interest formula I =PNR / 100 (where P- price, N- number of years, R- Rate of Interest)
- Find out the Area and Perimeter of a circle.
- Name different sections used in structure of a 'C' program by using arrows.K
#include ---------------->
Int s = 1;------------------------------>
main()-------------------------------->
{
Int a, b;------------------------------>
Printf("enter a&b values");
Scanf("%d%d", &a, &b,&c); }--->
S=add(a, b,c);
Printf("product is %d", S);
}
add(int x, int y,int z)
{
s=a+b+c; }-------->
return(s);
}
Tutorial 2
- Indentify which one is a Reserved word, Identifier, Constants, Variables.
Height perimeter '8' 0
Avg "Hello" 10 5.52
Sum "India" x #define N 10
Area 'a' y # define a 15
Auto sizeof goto default
-
main()
{
int i = 3
printf("%d", i);
printf("%d", i++);
printf("%d", i++);
printf("%d", ++i);
printf("%d",++i);
printf("%d", i++);
}
What is the output?
- Do the following:.
- Read int x & int y values and o/p c = 2a+3b. Implement that by using scanf & Printf statement.
- (1.) Condition 3 > 2 . (2.) print True or False. Implement that using conditional operator.
- Name different types of operators?
Tutorial 3
- Write a program by using following conditions. Read input value X.
If x = 0 print output value y = 0;
If x < 1 print output value y = -1;
If x > 1 print output value y = 1;
- Read the value of age, if age>17 print eligible for voting otherwise print not eligible.
- Write a program to find the roots of quadratic equation using if - else condition?
- Write a program to find the largest of 3 numbers using nested if - else statement?
-
main()
{
Int i,j;
for(i=1;i<=10;i++)
for(j=1;j<=3;j++)
{
If (i>3)
break;
Printf("%d%d",i,j);
}
Printf("comes out of the loop");
}
What is the output?
-
main( )
{
Int x;
Printf("enter a number");
Scanf("%d",&x);
If (x%2==0)
Goto even;
Else
Goto odd;
Even:printf("no is even");
Odd :printf("no is odd");
}
Find the output when
a) x=12;
b )x=27;
Tutorial 4
- Read two values a & b. Now write a program to perform Addition, Subtraction, Multiplication and Division of two numbers using switch.
- Write a program to display 1 to 20 numbers.
- Using while loop
- Using do - while.
- Using for - loop.
-
3. Write a program to implement nth table to the given number
- Using while loop
- Using do - while.
- Using for -loop.
PRACTICE PROBLEMS
Beginner Problems
- Name the different sections in the structure of a C program by using arrows.
-
/*Addition of 2 numbers*/
#include------>headerfile section(for example)
main()-------------
{
int a, b, c----------------
printf("enter a&b values");
scanf("%d%d", &a, &b); }-----
c = a+b;
printf("output is %d", C);
}
-
#include ----------------
int s = 1;------------------------------
main()--------------------------------
{
int a, b;-------------------------------
printf("nter a&b values");
scanf("%d%d", &a, &b); }---
s=mul(a, b);
printf("product is %d", s);
}
mul(int x, int y)
{
s=a*b; }---
return(s);
}
- Write different types of control string used for their data type?
-
- Char-%c (for example)_______
- Short or int _______________
- long __________________
-
- Double__________________
- Long double_______________
- Char_____________________
- Here x = 11; y = 12.5. Write a program to compute Addition, Subtraction and Multiplication of two numbers.
- Write a program to find out the area of a square for given side "s" area = s*s, perimeter = 4*s.
- Name some key words or reserved words used by compiler.
- Indentify which one is a Reserved word, Identifier, Constants, Variables.
Height perimeter "8" 0
Avg "Hello" 10 5.52
Sum "India" x #define N 10
Area "a" y # define a 15
Matrix[3]
Ex: height ->variable,identifier
- Name different operators used in the expression?
- Int a, b
- 5>3: y = 5: y : 3
- Printf("%d", x++)
- printf("%d", - -x);
- Name the different operators used in the expression.
- z* y ++___________
- printf("%", &x)______
- x = 10 size of (x)_____________
- a < = b_____________
- 5 > 3 && 5 < 10_____________
- 8 > 5 || 8 < 2 ___________
- X >> = 2__________
- X<< = 3___________
- a = 8 ; b = 4; c = a*b____________
- a = 8, b = 4 c = a&b
printf("%d", c);
output = ________
- a = 8; b = 8 c = a&b
printf("%d", c);
output = ________
- Write the difference between "=" and"=="
- X = 10 * 10 = _______________
- 8 % 10 = __________________
- If i=3then value of i++ is ____________
main()
{
int a, b, c;
a = 3; b = 5;
c = (ba)
printf("%d",c);
}
Output = ___
- x = 3.3; y = 4; write a program to print the output x+y+2*3.
- Write syntax for if statement.
- Write syntax for if? else.
- Write a program by using if ? else statement.
- If user enter character is "S" and age is less <20 then print girl is excellent, otherwise print ok.
- Write the syntax for nested if ? else statement.
- The break statement allows us to terminate the _____________
- If we use break statement in the inner loop, the control of the program is terminated only from the ______________________.
- In __________________ statement if it occurs in the loop, it skips the statement after this statement and continues the loop.
- In which general decision control statement we use more times a break statement?
- Goto statement requires condition T/F [ ]
- Goto statement passes control ______________ in the program.
- In which loop at least once it will executed _____________________.
- If we write a program in one loop we can write that program in other loops also T/F [ ]
- The default statement in switch is executed ___________________.
Intermediate Problems
- How you declare these variables.
- X = 20
- Y = 12.3
- C = ""
- D = "uma"
- Phone no: 232848
- 6. cell no: 9866132848.
Ex: int x;
- 16 >> 2 = __________________
- If k = 8 then value of k++ - k++ is _______________
- pi=3.14, l & b are length & breadth of rectangle. Write a program to find out the area (l*b) and perimeter 2*( l+b) of a rectangle?
- Write a program by using if statement following these conditions
- If user enters character "N" print girl is Nice
- If user enters character "S" print girl is Super.
- If user enters any other character print not nice.
- Write a program to find out the smallest of 3 numbers using nested " if " else?
-
for(i=1 ;i<=3;i++)
for(j=1;j<=2;j++)
for i=1 iteration j executes for values j= ___&j=_____;
for i=___ iteration j executes for values j=1 & j=2;
for i=3 iteration j executes for values j= ___&j=_____;
Advanced Problems
- Write a program to swap two numbers without using 3rd variable"
- Write the differences between a character and a string
- Generally where do we use "continue" statement"
- Write a program to print, multiples of "3" using.
- for loop
- while " loop
- do - while
for(i=1 ;i<=3;i++)
for(j=1;j<=2;j++)
How many times totally this loop executes"
This Page Is Designed By D.L.N.Raju
|