Anda di halaman 1dari 3

1. Write a program to swap 2 variables.

2. Write a program to count the no of chanracters in a string


3. Write C programs to implement the toupper() and the isupper() functions
4. WAP to implement strlen function
5. Read abt basic concepts of computer networks, typical questions would be
- about different classes of addresses.
- How does a packet traverse inside a network.
- Lear about few routing protocols.
6. Programs about bitwise operators.
- How to find that a number is a power of 2. ----------> int ispow2(int
number) { if(n<o) { return 0; } else { return !(number&(number-1)); }
- How to find whether a number has al 1s
- WAP to set m bits starting from nth bit in a number.
- Set a nth bit to 0.
- Set n bits to 0 , and similar programs.
7. Operating system concepts
- What happens when a OS boots up.
the CPU initializes itself, which is triggered by a seri
es of clock ticks generated by the system clock,a pin on the CPU sets the addres
s register to a set address (000000 on most chips) and sets the CPU to fetch its
first command.
A ROM at that address contains a start-up program called
the bootstrap.
The ROM BIOS stores the first instruction, which is the
instruction to run the power-on self test (POST), in a predetermined memory addr
ess.
POST begins by checking the BIOS chip and then tests CMO
S RAM.
If the POST does not detect a battery failure, it then c
ontinues to initialize the CPU, checking the inventoried hardware devices (such
as the video card), secondary storage devices, such as hard drives and floppy dr
ives, ports and other hardware devices, such as the keyboard and mouse, to ensur
e they are functioning properly.
Once the POST has determined that all components are fun
ctioning properly and the CPU has successfully initialized, the BIOS looks for a
n OS to load.
The order of drives that the CMOS looks to in order to l
ocate the OS is called the boot sequence, which can be changed by altering the C
MOS setup.
Looking to the appropriate boot drive, the BIOS will fir
st encounter the boot record, which tells it where to find the beginning of the
OS and the subsequent program file that will initialize the OS.
Once the OS initializes, the BIOS copies its files into
memory and the OS basically takes over control of the boot process.
Now in control, the OS performs another inventory of the
system's memory and memory availability (which the BIOS already checked) and lo
ads the device drivers that it needs to control the peripheral devices, such as
a printer, scanner, optical drive, mouse and keyboard.
This is the final stage in the boot process, after which
the user can access the system s applications to perform tasks.
- process concepts
- Memore management concepts.
- What is a deadlock.
8. Write your own strcat() function
9. Write a C program to swap two variables without using a temporary variable a=
a+b;b=a-b;a=a-b;
10. WAP to reverse a string
11. WAP to find whether a string is a palindrome.
12. Write a C program for calculating the factorial of n. -----> int fact(int n)
{ if(n==1) return 1; else return(n*fact(n-1)); }
13. Write a C program to generate fibonacci numbers. ------> unsigned int i=0
,j=0,sum=1,num;
printf("nEnter t
he limit for the series ");
scanf("%d",&num)
;
while(sum<num)
{ printf("%d ",sum); i=j; j=sum; sum=i+j; }
14. WAP to generate the bit pattern of a number given the number.
void bit(int n) { int i,m; for(i=15;i>=0;i--) { //testing ith bit //testing ith
bit requires masking //the masking is done through 1<<i m=1<<i;
if((n&m)==0) { printf("0"); }
else { printf("1"); } } }
15. Write a C program to find the GCD of two numbers.
int lcm(int a,int b)
{
int n;
for(n=1;;n++)
{
if(n%a == 0 && n%b == 0)
return n;
}
}
{
int c;
while(1)
{
c = a%b;
if(c==0)
return b;
a = b;
b = c;
}
}
16, Ttraversing a linked list.

typedef struct list


{
int number;
struct list *next;
}node;
node *head=NULL;
void create()//create linked list
{
int val;
node *p;
while(1)
{
printf(" Enter data (Enter -1 to exist) : ");
scanf("%d",&val);
if(val!=-1)
{
if(head==NULL)
{
p=(node*)malloc(sizeof(node));
p->next =NULL;
head=p;
p->number =val;
}
else
{
p=(node*)malloc(sizeof(node));
p->next =head;
head=p;
p->number =val;
}
}
else
break;
}
}
void traverse()//traverse list
{
node *p=head;
while(p!=NULL)
{
printf(" %d " ,p->number );
p=p->next ;
}
}
void search()//search by value
{
node *p=head;
int i=0,val;
printf("Enter any number for search :");
scanf("%d",&val);
while(1)
{
if(p->number ==val)
{
printf("\n\n\t\t\tThe value entered found at position %d
\n\n\n",i);
break;
}
else
{
i++;
p=p->next ;
printf("\n\n\t\tSearch ended Unsuccessfully. . . ! ! The
value entered not found\n\n\n");
break;
}
}
}
17. Small programs on pointers and arrays.

Anda mungkin juga menyukai