Wednesday, November 18, 2015

SLIPTEST QUESTIONS FOR CSE-B ON 20/11/2015(FRIDAY)



Slip test Questions for Cp To Cse-B on 20th Nov 2015
1 Briefly explain the structure of c-program?
2 How to create, run and execute the c-program?
3 Explain the different types of operators?
4 program development steps?
Programs
1. Sum of given n numbers.

2. Perfect number?

3. Palindrome number?

4. Roots of quadratics equations?

#include <stdio.h>
#include <math.h> /* This is needed to use sqrt() function.*/
int main()
{
  float a, b, c, determinant, r1,r2, real, imag;
  printf("Enter coefficients a, b and c: ");
  scanf("%f%f%f",&a,&b,&c);
  determinant=b*b-4*a*c;
  if (determinant>0)
  {
      r1= (-b+sqrt(determinant))/(2*a);
      r2= (-b-sqrt(determinant))/(2*a);
      printf("Roots are: %.2f and %.2f",r1 , r2);
  }
  else if (determinant==0)
  {
    r1 = r2 = -b/(2*a);
    printf("Roots are: %.2f and %.2f", r1, r2);
  }
  else
  {
    real= -b/(2*a);
    imag = sqrt(-determinant)/(2*a);
    printf("Roots are: %.2f+%.2fi and %.2f-%.2fi", real, imag, real, imag);
  }
  return 0;
}
Output 1 :Enter coefficients a, b and c: 2.3
4
5.6
Roots are: -0.87+1.30i and -0.87-1.30i
Output 2    :Enter coefficients a, b and c: 4
1
0
Roots are: 0.00 and -0.25
 
RECORD PROGRAMS:The following programs are shown in the lab in original record 
on 20/11/2015,in cp-lab
1.write a c program to print the area of triangle?
2.s=ut+1/2 *a*pow(t,2);
3 .write a c program to print the sum of given n numbers?
4 .write a c program to print the perfect number?
5 .write a c program to print the palindrome number?
6 .write a c program to find the roots of quadratic equation?
 

Tuesday, November 10, 2015

CP friday Exam Questions


         FRIDAY WRITTEN TEST QUESTIONS FOR CP

1.What are the various datatypes in c language?
2.Explain about formatted unformatted I/O functions?
3.Explain the looping statements?
4.Explain  switch case statement? with an Example?
5.Explain the unconditional statements in c?(BREAK,GOTO,CONTINUE)

Thursday, November 5, 2015

C-Program Number Technics



C-PROGRM NUMBER TECHNICS

Definition of perfect number or What is perfect number? 
Perfect number is a positive number which sum of all positive divisors excluding that number is equal to that number. For example 6 is perfect number since divisor of 6 are 1, 2 and 3.  Sum of its divisor is
1 + 2+ 3 =6
Note: 6 is the smallest perfect number.
Next perfect number is 28 since 1+ 2 + 4 + 7 + 14 = 28
Some more perfect numbers: 496, 8128

Definition of Armstrong number or what is an Armstrong number:
Definition according to c programming point of view:

Those numbers which sum of the cube of its digits is equal to that number are known as Armstrong numbers. For example 153 since 1^3 + 5^3 + 3^3 = 1+ 125 + 9 =153
Other Armstrong numbers: 370,371,407 etc.
In general definition:
Those numbers which sum of its digits to power of number of its digits is equal to that number are known as Armstrong numbers.
Example 1: 153
Total digits in 153 is 3
And 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153
Example 2: 1634
Total digits in 1634 is 4
And 1^4 + 6^4 + 3^4 +4^4 = 1 + 1296 + 81 + 64 =1634
Examples of Armstrong numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727, 93084, 548834, 1741725

Definition of strong number:

A number is called strong number if sum of the factorial of its digit is equal to number itself. For example: 145 since
1! + 4! + 5! = 1 + 24 + 120 = 145
Reverse Of Given Numbers
Sample output:
Enter any positive integer: 234561000045645679001237800000000000
Reverse: 8732100976546540000165432





Swapping Of Given Numbers

Sample output:
Enter any two integers: 3 6
Before swapping: a = 3, b=6
After swapping: a = 6, b=6


Definition of prime number:
A natural number greater than one has not any other divisors except 1 and itself. In other word we can say which has only two divisors 1 and number itself. For example: 5
Their divisors are 1 and 5.
Note: 2 is only even prime number.
Logic for prime number in c
We will take a loop and divide number from 2 to number/2. If the number is not divisible by any of the numbers then we will print it as prime number.
Example of prime numbers : 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199 etc.


Definition of Palindrome number or What is palindrome number?

A number is called palindrome number if it is remain same when its digits are reversed. For example 121 is palindrome number. When we will reverse its digit it will remain same number i.e. 121
Palindrome numbers examples: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191 etc. 

Definition of Palindrome string:

A string is called palindrome if it symmetric. In other word a string is called palindrome if string remains same if its characters are reversed. For example: asdsa
If we will reverse it will remain same i.e. asdsa

Example of string palindrome:  a,b, aa,aba,qwertrewq etc.





What is Fibonacci series?

Logic of Fibonacci series

Definition of Fibonacci numbers:
We assume first two Fibonacci are 0 and 1
A series of numbers in which each sequent number is sum of its two previous numbers is known as Fibonacci series and each numbers are called Fibonacci numbers. So Fibonacci numbers is

Algorithm for Fibonacci series 

Fn = Fn-2 + Fn-1

Example of Fibonacci series:

0 , 1 ,1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55  ...

5 is Fibonacci number since sum of its two previous number i.e. 2 and 3 is 5
8 is Fibonacci number since sum of its two previous number i.e. 3 and 5 is 8 and so on.

Factorial value

Factorial of number is defined as:
Factorial (n) = 1*2*3 … * n
For example: Factorial of 5 = 1*2*3*4*5 = 120
Note: Factorial of zero = 1 

Wednesday, October 28, 2015

1st MID MARKS for CSE-B



CSE-B 1st Mid Marks
SNO
HTNO
THEORY
OBJECTIVE
ASSIGNMENT
1
15QP1A0561
7
5
5
2
15QP1A0562
10
5
4
3
15QP1A0563
7
5
4
4
15QP1A0564
7
6
5
5
15QP1A0565
6
6
4
6
15QP1A0566
8
6
4
7
15QP1A0567
8
5
3
8
15QP1A0568
5
7
3
9
15QP1A0569
8
6
5
10
15QP1A0570
9
7
5
11
15QP1A0571
10
6
5
12
15QP1A0572
9
5
4
13
15QP1A0573
7
5
5
14
15QP1A0574
7
8
3
15
15QP1A0575
10
8
5
16
15QP1A0576
9
7
3
17
15QP1A0577
10
6
5
18
15QP1A0578
8
7
4
19
15QP1A0579
7
6
4
20
15QP1A0580
8
6
5
21
15QP1A0581
6
5
5
22
15QP1A0582
9
6
3
23
15QP1A0583
8
6
5
24
15QP1A0584
9
7
3
25
15QP1A0585
8
5
5
26
15QP1A0586
7
7
3
27
15QP1A0587
7
4
5
28
15QP1A0588
7
6
4
29
15QP1A0589
5
5
4
30
15QP1A0590
9
4
5
31
15QP1A0591
9
6
5
32
15QP1A0592
7
4
3
33
15QP1A0593
7
6
5
34
15QP1A0594
4
5
3
35
15QP1A0595
8
6
5
36
15QP1A0596
9
6
5
37
15QP1A0597
8
5
4
38
15QP1A0598
10
7
3
39
15QP1A0599
10
7
4
40
15QP1A05A0
9
6
5
41
15QP1A05A1
10
6
5
42
15QP1A05A2
9
6
5
43
15QP1A05A3
10
7
4
44
15QP1A05A4
7
5
3
45
15QP1A05A5
9
5
5
46
15QP1A05A6
7
6
5
47
15QP1A05A7
9
5
5
48
15QP1A05A8
8
6
5
49
15QP1A05A9
6
6
5
50
15QP1A05B0
6
6
3
51
15QP1A05B1
9
8
5
52
15QP1A05B2
8
5
5
53
15QP1A05B3
8
5
5
54
15QP1A05B4
6
7
3
55
15QP1A05B5
10
7
5
56
15QP1A05B6
8
6
5
57
15QP1A05B7
10
5
4
58
15QP1A05B8
8
5
4
59
15QP1A05B9
8
7
5
60
15QP1A05C0
9
7
5
 
NOTE: final marks likely to be changed by the H.O.D based on the student performance in the class room