Archive for c language extra questions
You are browsing the archives of c language extra questions.
You are browsing the archives of c language extra questions.
Answer :
C++ places greater emphasis on type checking, compiler can diagnose every difference between C and C++.
1. structures are a way of storing many different values in variables of potentially difference types under the same name.
2. classes and structures make program modular, easier to modify make things compact.
3. useful when a lot of [...]
21. What is the full form of CMM
(a) Capability Maturity Model
(b) Cost Maintainance Model
(c) Capability maintainance model
(d) Cost Maturity Model
Ans:A
22. Sorting is not possible by using which of the following methods?
(a) Insertion
(b) Selection
(c) Exchange
(d) Deletion
Ans:D
23. What are the methods available in storing sequential files ?
(a) Straight merging,
(b) Natural merging,
(c) Polyphase sort
(d) all
Ans:D
24. Conditional results [...]
1. What type of memory could be accessed in least time?
(a)cache memory
(b)secondary memory
(c)main memory
(d)none
Ans:A
2. void main()
{
int const * p=5;
printf("%d",++(*p));
}
What is the output?
(a) 6
(b) 5
(c) [...]
1.What is data structure?
A data structure is a way of organizing data that considers not only the items stored, but also their relationship to each other. Advance knowledge about the relationship between data items allows designing of efficient algorithms for the manipulation of data..
2. List out the areas in which data structures are applied extensively?
Compiler [...]
Data Structure - Exam Oriented Material
Must Read Before Examination
1. What is data structure?
A data structure is a way of organizing data that considers not only the items stored, but also their relationship to each other. Advance knowledge about the relationship between data items allows designing of efficient algorithms for the manipulation of [...]
/*queue various operation*/
#include<stdio.h>
#include<conio.h>
#define MAXSIZE 5
int front=-1, rear=-1,choice;
int q[10];
void main()
{
clrscr();
do
{
printf("\n1–>insert\n");
printf("2–>delete\n");
printf("3–>display\n");
printf("4–>exit\n");
printf("enter your choice\n");
scanf("%d",&choice);
switch(choice)
{
case 1:qinsert();
break;
case 2:qdelete();
break;
case 3:qdisplay();
break;
case 4:return;
}
}
while(choice!=4);
}
qinsert()
{
int num;
if(rear==(MAXSIZE-1))
{
printf("queue is full\n");
return;
}
else
{
printf("enter no\n");
scanf("%d",&num);
rear=rear+1;
q[rear]=num;
if(front==-1)
{
front++;
}
}
return;
}
qdelete()
{
int num;
if(front==-1)
{
printf("queue empty\n");
return;
}
else
{
if(front==rear)
front=rear=-1;
else
{
num=q[front];
printf("deleted item=%d",q[front]);
front++;
}
}
return(num);
}
qdisplay()
{
int i;
if(front==-1)
{
printf("queue empty\n");
return;
}
else
{
printf("\nThe status of the queu\n");
for(i=front;i<=rear;i++)
{
printf("%d\n",q[i]);
}
}
printf("\n");
}
/*search*/
#include<stdio.h>
#include<conio.h>
void main()
{
int [...]
/*queue*/
#include<stdio.h>
#include<conio.h>
#define MAXSIZE 5
int cq[10];
int front=-1,rear=0;
int choice;
char ch;
void main()
{
clrscr();
do
{
printf("——–1.Insert——-\n");
printf("——- 2. Delete——–\n");
printf("——- 3. Display——–\n");
printf("——-4.exit————\n");
printf("Enter your choice\n");
scanf("%d",&choice);
switch(choice)
{
case 1 : cqinsert();
break;
case 2 : cqdelete();
break;
case 3 : cqdisplay();
break;
case 4: return;
}
[...]
/*linked list*/
#include<stdio.h>
#include<conio.h>
#include<malloc.h>
void main()
{
struct node
{
int num;
struct node *ptr;
};
typedef struct node NODE;
NODE *head, *first, *temp;
int count=0;
int choice=1;
first=NULL;
while(choice)
{
head=(NODE *)malloc(sizeof(NODE));
printf("Enter the data item\n");
scanf("%d",&head->num);
if(first!=NULL)
{
temp->ptr=head;
temp=head;
}
else
{
first=temp=head;
}
fflush(stdin);
printf("Do you want to continue(type 0 or 1)?\n");
scanf("%d",&choice);
}
temp->ptr=NULL;
temp=first;
printf("Status of the linked list is\n");
while(temp!=NULL)
{
printf("%d",temp->num);
count++;
temp=temp->ptr;
}
printf("NULL");
printf("NO of nodes in the list =%d\n",count);
getch();
}
/*insertion in tree*/
#include<stdio.h>
#include<conio.h>
struct rec
{
long num;
struct rec *left;
struct rec *right;
};
struct rec *tree=NULL;
struct [...]
/*Insertion and Deletion*/
#include<stdio.h>
#include<conio.h>
struct stack
{
int no;
struct stack *next;
}
*start=NULL;
typedef struct stack st;
void push();
int pop();
void display();
void main()
{
char ch;
int choice,item;
do
{
clrscr();
printf("\n 1: push");
printf("\n 2: pop");
printf("\n 3: display");
printf("\n Enter your choice");
scanf("%d",&choice);
switch (choice)
{
case 1: push();
break;
case 2: item=pop();
printf("The delete element in %d",item);
break;
case 3: display();
break;
default : printf("\n Wrong choice");
};
printf("\n do you want to continue(Y/N)");
fflush(stdin);
scanf("%c",&ch);
}
while (ch==’Y'||ch==’y');
}
void push()
{
st *node;
node=(st *)malloc(sizeof(st));
printf("\n Enter the number to be insert");
scanf("%d",&node->no);
node->next=start;
start=node;
}
int [...]
/*insert subtree*/
#include<stdio.h>
#include<conio.h>
struct rec
{
long num;
struct rec *left;
struct rec *right;
};
struct rec *tree=NULL;
struct rec *insert(struct rec *tree,long num);
void *exchange(struct rec *tree);
struct rec *temp;
void main()
{
struct rec *tree=NULL;
int choice;
long digit;
do
{
choice=select();
switch(choice)
{
case 1: puts("Enter integer: To quit enter [...]
/*initialising the arrray*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i;
clrscr();
printf("Enter the array");
for(i = 0;i <=9;i ++)
{
scanf("%d",&a[i]);
}
printf("The entered array is");
for(i = 0;i <=9; i++)
{
printf("%d\n",a[i]);
[...]
/*Deletion in the Array*/
#include<stdio.h>
#include<conio.h>
int i,n;
main()
{
int a[100],pos;
void delete(int a[],int,int);
clrscr();
printf("How many elements in the array\n");
scanf("%d",&n);
printf("Enter the element of the array\n");
for(i=0;i<=n-1;i++)
scanf("%d",&a[i]);
printf("On which postion element do you want delete\n");
scanf("%d",&pos);
delete(a,pos,n);
getch();
}
void delete(int a[],int pos,int n)
{
int j,item;
item=a[pos];
for(j=pos;j<=n-1;j++)
{
a[j]=a[j+1];
}
n=n-1;
for(i=0;i<=n-1;i++)
printf("%d\n",a[i]);
}
/*Factorial*/
#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{
int n,result;
clrscr();
printf("Enter the number");
scanf("%d",&n);
result=fact(n);
printf("\n The factorial of %d is %d",n,result);
getch();
}
int fact(int x)
{
int f;
if(x==1)
[...]
1. What is the output of printf(”%d”)
2. What will happen if I say delete this
3. Difference between “C structure” and “C++ structure”.
4. Difference between a “assignment operator” and a “copy constructor”
5. What is the difference between “overloading” and “overriding”?
6. Explain the need for “Virtual Destructor”.
7. Can we have “Virtual Constructors”?
8. What are the different types of polymorphism?
9. What are Virtual Functions? How to implement [...]
1. What is a class?
2. What is an object?
3. What is the difference between an object and a class?
4. What is the difference between class and structure?
5. What is public, protected, private?
6. What are virtual functions?
7. What is friend function?
8. What is a scope resolution operator?
9. What do you mean by inheritance?
10. What is abstraction?
11. What is polymorphism? Explain with an example.
12. What is encapsulation?
13. What do you [...]