-->

NEB31:What is pointer?explain it. With the help of program, explain about 'call by value' and 'call by reference'.

ans:
first part:-
                A pointer is a variable which points to the address and not its value. with the help of pointer, we can
                       ->we can allocate memory dynamically
                       ->better memory management
                        ->passing of array and string to the functions more efficiently
                        ->it helps us to return more values etc.
example:
   int *k;
here , k is a pointer and will store address of a variable.

second part:-
call by value:-
                         We can pass argments/parameters either by value or address.
 passing by value means we are going to copy the value directly to the formal arguments from real arguments. the change is formal arguments have no effect in real argument.Example is here.
// call by value
#include <stdio.h>

void callbyvalue(int, int);                            /* function Prototype i.e. function declaration */

void main()                                                 /* Main function */
{
  int x = 10, y= 20;                                 // variables declaration

                                                                    /* actual arguments will be as it is */
  callbyalue(x, y);                             // passing value of x and y
  printf("x= %d, y= %d\n", x, y);    // displaying the values
}

void callbyvalue(int m, int n)             // passing values to formal parameter m and n
{
  int t;
  t = m;
m = n;
 n = t;                              // swapping takes place
}

out put is: x=10,y=20
Here, the values of x and y are no affected by  values of m and n. so there will be no swapping.

call by reference:- We have now second method to pass our arguments/paramenter.In this, we use pointer to pass addressof parametersto the functions. in this way the values are copied to formalparameter and process continues there.example is given here.


// call by value reference
#include <stdio.h>
void callbyref(int*, int*);                                                          /* function Prototype */

void main()                                                                                   /* Main function */
{
  int x = 10, y = 20;                                                               //variable declaration

                                                                                                  /* actual arguments will be altered */
  callbyref(&x, &y);                                                               // passing addresss
  printf("x: %d, y: %d\n", x, y);                                            //displaying value after altering
}

void callbyref(int *m, int *n)
{
  int t;
  t = *m; *m = *n; *n = t;                                                     /swapping being done
}


output: x=20,y=10
In above example we have passed address of identifier x and y to the function.while passing address,its vale is copied to formal parameter and then swapping takes place. It means by passing address we can alter the value in real parameter which was not possible in call by value,



class 11 project details

--------------------------------------------------------------------------------------------------------------------------
Detail about project work:-

Project work: -

At the end of session students will be asked to prepare a project work on ‘web technology’. In this Project work students have to make a simple website using HTML and CSS. Students may choose a topic of their own interest.

Project work assessment is the internal assessment of reports and presentation of their project works either individually or group basis. In case of group presentation, every member of the group should submit a short reflection on the presented report in their own language.

1.1             Project work writing format:

Students have to follow same format as given by college.          

Formatting Guidelines
Project Work
         

Title page

Title of the project, name of the author(s), class, ID number, registration numbers, email, school name and address 

Title

Capitalize each word. / Be clear, informative & concise. / Avoid abbreviations,

Spacing

Double-space

Fonts

Times New Roman or Arial (Title – 14-point bold font / Body text – 12-point font)

Page Numbering

Bottom of the page, centre

Report structure

Divide body text into different sections with appropriate headings. Use standard headings as far as possible such as:

·        Introduction: Background, literature review, objectives & limitation

·        Materials & Methods: Equipment used & data collection procedure

·        Results or Findings: Presentation, analysis and interpretation of data / Give important details in tables and figures.

·        Conclusions: Highlight key findings

·        Acknowledgements

·        References 

Headings

Bold font on a separate line / No numbering for headings & subheadings

Paper

A4 size, white, one-sided printing

Page margins

Left 1.25”, Right 1”, Top 1”, Bottom 1”,Alignment-justify

Page Binding

Spiral

Webpage range

10-15 pages (total number of web pages to be in the project work)

Project work writing order (what to write and in what order):

1.cover page

2.project title page

3.Declaration page

4.Letter of approval page

5.Table of contents with page number

6.

6.1              Introduction: Background, literature review, objectives & limitation

Write theory of HTML and CSS ------maximum 4 pages

6.2              Materials & Methods: Equipment used & data collection procedure

What softwares/editors were used with what computer configurations?

List them out. Talk about processor, RAM, etc.

6.3              Results or Findings: Presentation, analysis and interpretation of data / Give important details in tables and figures/graphs.

->Put all source codes of HTML here. --------any 5 pages'

-> Screenshot of web page/site------------------any 5 pages

6.4              Conclusions: Highlight key findings

6.5              Acknowledgements

Acknowledgements enable you to thank all those who have helped in carrying out the research/work. Careful thought needs to be given concerning those whose help should be acknowledged and in what order. The general advice is to express your appreciation in a concise manner and to avoid strong emotive language.

Note that personal pronouns such as 'I, my, me …' are nearly always used in the acknowledgements while in the rest of the project such personal pronouns are generally avoided.

The following list includes those people who are often acknowledged.

Note however that every project is different and you need to tailor your acknowledgements to suit your particular situation.

Main supervisor

Second supervisor

Other academic staff in your department

Technical or support staff in your department

Academic staff from other departments

Other institutions, organizations or companies

Past students

Family
Friends

 

References / Bibliography
-----------------------------------------

       
            

Notes:-
                  1. Use passive voice while writing
                  2. Use third person (do not use I or we; instead use “it was done”)
                  3. Use proper formatting (justify)
                  4. If you need then you can use header and footer properly
          
                 5. Do not mix/use colors. Make it as simple as it has to be.
                 6.The topic for website should be chosen by student themselves.



1. You have to make the same format as given there
2. no copying or direct printing
3. On your exam day, bring all the works done (project work)in pen drive as well as in hardcopy. We may ask you to show softcopy.

---------------------------------
Useful links:
For
A.
   1.cover page

2.project title page

3.Declaration page

4.Letter of approval page

B.project sample

click here

-----------------------------------------------------------------

If any further questions still left in mind then mail me at:
                krishnaamallik@gmail.com
  
                                You will be responded!

NEB28:program to sort records using struct

//program to sort records using struct from a to z
#include<stdio.h>
#include<conio.h>
struct detail
{
int roll;
char name[100];
char address[100];
}var[100],temp;

void main()
{
int i,j,n;
printf("enter total records (less or than '100')\n");
scanf("%d",&n);
printf("now enter records of students\n");
for(i=0;i<n;i++)
{
printf("enter student's roll no.\n");
scanf("%d",&var[i].roll);
printf("enter student's name\n");
scanf("%s",var[i].name);
printf("enter student's address\n");
scanf("%s",var[i].address);
}
printf("now sorting from a to z on the basis of  address\n");
for(i=0;i<n;i++)
 {
     for(j=i+1;j<n;j++)
       {
            if((strcmp(var[i].address,var[j].address))>0)
                  {
                      temp=var[i];
                      var[i]=var[j];
                     var[j]=temp;
                   }
         }
}
printf("sorted data (from a to z i.e. ascending order )on the basis of address are:\n:");
  for(i=0;i<n;i++)
{
printf("student's roll=%d, name=%s,student's address=%s \n",var[i].roll,var[i].name,var[i].address);
}
getch();
}
----------------------------------------------------------------------------------------------------------
//program to sort records using struct(in descending order i.e. z to a)
#include<stdio.h>
#include<conio.h>
struct detail
{
int roll;
char name[100];
char address[100];
}var[100],temp;

void main()
{
int i,j,n;
printf("enter total records (less or than '100')\n");
scanf("%d",&n);
printf("now enter records of students\n");
for(i=0;i<n;i++)
{
printf("enter student's roll no.\n");
scanf("%d",&var[i].roll);
printf("enter student's name\n");
scanf("%s",var[i].name);
printf("enter student's address\n");
scanf("%s",var[i].address);
}
printf("now sorted data (z to a) on the basis of address are:\n:);
for(i=0;i<n;i++)
 {
     for(j=i+1;j<n;j++)
       {
            if((strcmp(var[i].address,var[j].address))<0)
                  {
                      temp=var[i];
                      var[i]=var[j];
                     var[j]=temp;
                   }
         }
}
  for(i=0;i<n;i++)
{
printf("student's roll=%d, name=%s,student's address=%s \n",var[i].roll,var[i].name,var[i].address);
}
getch();
}
--------------------------------------------------------------------------------
note:
Here I have done both, from 'a' to 'z' and 'z' to 'a'. You can do only one, either 'a' to 'z' or 'z' to 'a'. 

NEB30:Difference between struct and union

Ans:-
The differences between struct and union are given below in tabular form.
                   
struct
Union
1.It stores dis-similar data.Each gets separate space in memory.They do not share memory
1. It stores dis-similar type of data.Total memory space is equal to the member with largest size.They share memory space.
2.we can access member in any sequence .
2.We can access that whose value is recently used.
3.It uses keyword 'struct'
3.It uses keyword 'union'
4.We can initialize values of member/s and in any order
4.We can initialize that member which is first declared.
5.It consumes more memory
5.It consumes less memory.
6.Its syntax
    struct tag
{
datatype member1;
datatype member2;
datatype member3;
}variable;

6.Its syntax
    union tag
{
datatype member1;
datatype member2;
datatype member3;
}variable;

Example
struct student
{
int roll;
char sex;
float percentage;
}var;

Example
union student
{
int roll;
char sex;
float percentage;
}var;


NEB27:program to get factorial value of a number using recursion

//program to get factorial value of a number using recursion
#include <stdio.h>
#include <stdlib.h>
int recur(int n);
int main()
{
 int n;
 printf("ente a number\n");
 scanf("%d",&n);
printf("the factorial value is\n");
printf("%d",recur(n));
getch();
return 0;
}
int recur(int n)
{
 if(n<=0)
  {
          return 1;
}
else
{
    return n*recur(n-1);
}

}

NEB29:Difference between array and struct

Ans:-
Differences between array and struct are given below.                                                                                                                                                
Arraystruct
1.It stores same type of data1. It stores dis-similar type of data.
2.It uses static memory allocation . 2.I uses dynamic memory allocation.
3.It takes less time to access elements.3.It takes more time to access elements.
4.It uses index value to access elements. 4.It takes help of period operator(.) to access elements.
5.It is derived data type. 5. IT is user's defined data type.
6.We can not define array of array.          6.We can define array of structure.
7.Its syntax is                                          
data type identifier[value];








example,int a[20];
7.Its syntax is
struct tag
{datatype member1;
datatype member2;
data type member3;
}variable;
example,
struct det
{char name[100];
char add[40];
int  roll;
}variable;



program to know a matrix is identity or not

// program to know a matrix is identity or not
//to know a matrix is identity or not
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a[5][5],order,i,j,first=0,second=0;
printf("enter order\n");
scanf("%d",&order);
printf("enter matrix elements\n");
for(i=0;i<order;i++)
  {
    for(j=0;j<order;j++)
      {
       scanf("%d",&a[i][j]);
      }
  }
printf("the matrix is\n");
for(i=0;i<order;i++)
  {
    for(j=0;j<order;j++)
      {
       printf("%d",a[i][j]);
      }
    printf("\n");

  }
 for(i=0;i<order;i++)
  {
    for(j=0;j<order;j++)
      {
       if(i==j)
       {
first=first+1;
}
else
{
second=second+a[i][j];
}

  }
  }

  if(first==order && second==0)
  {
  printf("it is identity matrix\n");
  }
  else
  {
  printf("it is not");
  }

  getch();
  }