Showing posts with label C Programming examples. Show all posts
Showing posts with label C Programming examples. Show all posts

Thursday, 1 November 2012

CISCO 2012 Placement papers | cisco placement papers 2012 pattern | cisco placement papers with answers


CISCO: 2012: Sept at Chennai





 There were almost 40 technical questions and 10 analytical questions. Total 50 questions.



Cisco Placements Technical questions :

1. Which of the following is connectionless protocol

Ans: UDP(User Datagram Protocol)

2.

 #define clrscr() 100

main()

{

clrscr();

printf("%d",clrscr());

}

3. Which of the following is used for avoiding network congestion

buffering

caching

source-quench

all of the above

4. main()

{

int a;

printf("%d",scanf(%d,&a));

}

whats o/p of this program..what will b printed

Ans :0

5.

main()

{

printf("as");

printf("\bhi");

printf("is\n");

}

wat will b printed.

6.

main()

{

unsigned short a=-1;

unsigned char b=a;

printf("%d %d ",a,b);

}

wat is o/p of the program

a. 65535 -1 b. 65535 65535 c. -1 -1

7. Arrays base address is 1000....array is a[5][4]..then wat is de

correct address of a[4][3].

Ans:1056

8. One packet is 64 bytes no. of pkts send is 16000 then total no. of bytes send is

Ans 1024000

9. #define maxval 5

int main (void)

{

int i=1;

if(i-maxval)

{

printf("inside");

}

else

{

printf("out");

}

find o/p???

10.

#define a 3+3

#define b 11-3

main()

{

printf("%d",a*b);

}

what is o/p?????

11. A question in which segment address is given logical address is 800 base addresses also given you have to find physical address.

12. Stack is used in a task

Ans: temporary variables values

13. Which of de following is not stored in activation record..

Ans: some heap area

14. main{

printf("%d",-1<<4); } wats o/p??? ans: 0xfff0

15. main() { int* s s=10 printf("%d,%d,%d,%d,%d,%d",*s++,(*s)++,++*s,++(*s)); } whats o/p?

16. There was a question on processor speed in nanocycles..then it performs a instruction in x cycles..dont remember

17. main() { int *i; int s=(int *)malloc(10*sizeof(int)); for (i=0;i<10;i++) { printf("%d",i*i) } wats o/p

18. One more similar question Cisco  Conducted On   Computer awareness test.

1. In the command scanf, h is used for

Ans. Short int

2. A process is defined as

Ans. Program in execution

3. A thread is

Ans. Detachable unit of executable code.

4. What is the advantage of Win NT over Win 95

Ans. Robust and secure

5. How is memory management done in Win95

Ans. Through paging and segmentation

6. What is meant by polymorphism

Ans. Redefinition of a base class method in a derived class

7. What is the essential feature of inheritance

Ans. All properties of existing class are derived

8.What does the protocol FTP do

Ans. Transfer a file b/w stations with user authentication

9.In the transport layer ,TCP is what type of protocol

Ans. Connection oriented

10.Why is a gateway used

Ans. To connect incompatible networks

11.How is linked list implemented

Ans. By referential structures

12.What method is used in Win95 in multitasking

Ans. Non preemptive check

13.What is meant by functional dependency

14.What is a semaphore

Ans. A method synchronization of multiple processes

15.What is the precedence order from high to low ,of the symbols ( ) ++ /

Ans.( ) , ++, /

16.Preorder of A*(B+C)/D-G Ans.*+ABC/-DG

18. B-tree (failure nodes at same level)

19. Dense index (index record appears for every search -key in file)

20.What is the efficiency of merge sort

Ans. O(n log n)

21.A program on swapping ( 10,5 )was given (candidate cannot recollect)

22.In which layer are routers used

Ans.In network layer 23.In which layer are packets formed ( in network layer )

24. heap ( priority queue )

25. Copy constructor ( constant reference )

26.Which of the following sorting algorithm has average sorting behavior,  Bubble sort, merge sort, heap sort, exchange sort

Ans. Heap sort

27.In binary search tree which traversal is used for getting ascending order values Inorder, post order, preorder Ans. In-order

28.What are device drivers used for

Ans.To provide software for enabling the hardware

29. Irrelevant to UNIX command ( getty)

30.What is fork command in UNIX

Ans. System call used to create process

31.What is make command in UNIX

Ans. Used for-creation of more than one file

32.In UNIX .profile contains

Ans. Start up program

33.In UNIX echo is used for

( answer C)

34.In UNIX 'ls 'stores contents in

Ans.inode block QUANTITATIVE SECTION

1. In a class composed of x girls and y boys what part of the class is composed of girls A.y/(x + y) B.x/xy C.x/(x + y) D.y/xy [Ans.C ]

2.What is the maximum number of half-pint bottles of cream that can be filled with a 4-gallon can of cream(2 pt.=1 qt. and 4 qt.=1 gal) A.16 B.24 C.30 D.64 [Ans.D ]

3. If the operation,^ is defined by the equation x ^ y = 2x + y,what is the value of a in 2 ^ a = a ^ 3 A.0 B.1 C.-1 D.4 [Ans.B ]

4. A coffee shop blends 2 kinds of coffee,putting in 2 parts of a 33p. a gm. grade to 1 part of a 24p. a gm. If the mixture is changed to 1 part of the 33p. a gm. to 2 parts of the less expensive grade,how much will the shop save in blending 100 grams. A.Rs.90 B.Rs.1.00 C.Rs.3.00 D.Rs.8.00 [Ans.C ]

5. There are 200 questions on a 3 hr examination. Among these questions are 50 mathematics problems. It is suggested that twice as much time be spent on each maths problem as for each other question. How many minutes should be spent on mathematics problems A.36 B.72 C.60 D.100

Ans.B

6. In a group of 15,7 have studied Latin, 8 have studied Greek, and 3 have not studied either. How many of these studied both Latin and Greek A.0 B.3 C.4 D.5

Ans.B

7. If 13 = 13w/(1-w) ,then (2w)2 = A. 1/4 B. 1/2 C. 1 D. 2 [Ans.C ]

8. If a and b are positive integers and (a-b)/3.5 = 4/7, then (A) b < a (B) b > a

(C) b = a (D) b >= a [Ans. A]

9. In June a baseball team that played 60 games had won 30% of its game played. After a phenomenal winning streak this team raised its average to 50% .How many games must the team have won in a row to attain this average? A. 12 B. 20 C. 24 D. 30 [Ans. C]

10. M men agree to purchase a gift for Rs. D. If three men drop out how much more will each have to contribute towards the purchase of the gift.

A. D/(M-3) B. MD/3 C. M/(D-3) D. 3D/(M2-3M) [Ans. D]

11. A company contracts to paint 3 houses. Mr.Brown can paint a house in 6 days while Mr.Black would take 8 days and Mr.Blue 12 days. After 8 days Mr.Brown goes on vacation and Mr. Black begins to work for a period of 6 days. How many days will it take Mr.Blue to complete the contract? A. 7 B. 8 C. 11 D. 12 [Ans.C]

 12. 2 hours after a freight train leaves Delhi a passenger train leaves the same station travelling in the same direction at an average speed of 16 km/hr. After traveling 4 hrs the passenger train overtakes the freight train. The average speed of the freight train was?

A. 30 B. 40 C.58 D. 60 [Ans. B]

 13. If 9x-3y=12 and 3x-5y=7 then 6x-2y = ? A.-5 B. 4 C. 2 D. 8 [Ans. D]

Tuesday, 12 June 2012

C program Examples questions | Sample C programs | Practise questions on c | Assignment Programs on c


1. Write a c program to check given number is perfect number or not.
2. Write a c program to check given number is Armstrong number or not.
3. Write a c program to check given number is prime number or not.


4. Write a c function program to reverse any number.

5. Write a c program to check given number is strong number or not.
6. Write a c program to find out sum of digit of given number.
7. Write a c program to check given number is palindrome number or not.

string:
=======
8. Write a c program to check given string is palindrome number or not.

9. Write a c program to find out power of number.          
10. Write a c program to add two numbers without using addition operator.
11. Write a c program to subtract two numbers without using subtraction operator.
12. Write a c program to find largest among three numbers using binary minus operator.
13. Write a c program to find largest among three numbers using conditional operator
14. Write a c program to find out generic root of any number.


15. Write a c program to solve quadratic equation.
18. Write a c program which passes structure to function.



16. Write a c program which passes one dimension array to function.
17. Write a c program which passes two dimension array to function.


19. Write a c program for Floyd’s triangle.
20. Write a c program to print Pascal triangle.
21. Write a c program to generate multiplication table.
22. Write a c program to get factorial of given number.
23. Write a c program to find out prime factor of given number.
24. Write a c program to find out NCR factor of given number.
25. Write a c program to print Fibonacci series of given range.
26. Write a c program to print ASCII value of all characters.
27. Write a c program to check given year is leap year or not.


28. Write a c function program which takes password from user.
29. Write a scanf function in c which accept sentence from user.
30. Write a scanf function in c which accept paragraph from user.


31. Write a c program to print the all prime numbers between 1 to 300.


L.C.M and H.C.F.
32. Write a c program to find out L.C.M. of two numbers.
33. Write a c program to find out H.C.F. of two numbers.
34. Write a c program to find out G.C.D. of two numbers.


Swapping

35. Write a c program to swap two numbers.
35. Write a c program to swap two numbers without using third variable.
36. Write a c program for swapping of two arrays.
37. Write a c program for swapping of two string.



Conversion


38. Write a c program to convert decimal number to hexadecimal number.
39. Write a c program to convert hexadecimal number to decimal number.
40. Write a c program to convert decimal number to octal number.
41. Write a c program to convert octal number to decimal number.
42. Write a c program to convert binary number to decimal number.
43. Write a c program to convert decimal number to binary number.
44.Write a c program to convert farehnite to centigrade.
45.Write a c program to convert centigrade to farehnite.





7.Write a c program to convert binary number to octal number.
8. Write a c program to convert binary number to hexadecimal number.
11. Write a c program to convert hexadecimal number to binary number.
12. Write a c program to convert octal number to binary number.


String


1. Write a c program to convert the string from upper case to lower case.
2. Write a c program to convert the string from lower case to upper case.
3. Write a c program to delete the all consonants from given string.
4. Write a c program to count the different types of characters in given string.
5.  Write a c program to sort the characters of a string.
6. Write a c program for concatenation two strings without using string.h header file.
7. Write a c program to find the length of a string using pointer.
8. Write a c program which prints initial of any name.
9. Write a c program to print the string from given character.
Matrix


1. Write a c program for addition of two matrices.
2. Write a c program for subtraction of two matrices
3. Write a c program for multiplication of two matrices.
4. Write a c program to find out sum of diagonal element of a matrix.
5. Write a c program to find out transport of a matrix.
File


1. Write a c program to open a file and write some text and close its.
2.  Write a c program to delete a file.
3. Write a c program to copy a file from one location to other location.
4. Write a c program to copy a data of file to other file.
5. Write a c program which display source code as a output.
6. Write a c program which writes string in the file.
7. Write a c program which reads string from file.
8. Write a c program which writes array in the file.
9. Write a c program which concatenate two file and write it third file.
10. Write a c program to find out size of any file.
11. Write a c program to know type of file.
12. Write a c program to know permission of any file.
13. Write a c program to know last date of modification of any file.
14. Write a c program to find size and drive of any file.
Complex number


1. Write a c program for addition and subtraction of two complex numbers.
2. Write a c program for multiplication of two complex numbers.
3. Write a c program for division two complex numbers.
Series


1. Write a c program to find out the sum of series 1 + 2 + ….  + n.
2. Write a c program to find out the sum of series 1^2 + 2^2 + …. + n^2.
3. Write a c program to find out the sum of series 1^3 + 2^3 + …. + n^3.
4. Write a c program to find out the sum of given A.P.
5. Write a c program to find out the sum of given G.P.
6. Write a c program to find out the sum of given H.P.
7. Write a c program to find out the sum of series 1 + 2 + 4 + 8 … to infinity.
Array


1. Write a c program to find out largest element of an array.
2. Write a c program to find out second largest element of an unsorted array.
3. Write a c program to find out second smallest element of an unsorted array.
4. Write a c program which deletes the duplicate element of an array.
5. Write a c program for delete an element at desired position in an array.
6. Write a c program for insert an element at desired position in an array.
Sorting


1. Write a c program for bubble sort.
2. Write a c program for insertion sort.
3. Write a c program for selection sort.
4. Write a c program for quick sort.
5. Write a c program for heap sort.
6. Write a c program for merge sort.
7. Write a c program for shell sort.
Recursion


1. Write a c program to find factorial of a number using recursion.
2. Write a c program to find GCD of a two numbers using recursion.
3. Write a c program to find out sum digits of a number using recursion.
4. Write a c program to find power of a number using function recursion.
5. Write a c program to reverse any number using recursion.
Size of data type


1. Write a c program to find the size of int without using sizeof operator.
2. Write a c program to find the size of double without using sizeof operator.    
3. Write a c program to find the size of structure without using sizeof operator.
4. Write a c program to find the size of union without using sizeof operator.
Using pointer


1. Write a c program for concatenation two string using pointer.
Searching


1. Write a c program for linear search.
2. Write a c program for binary search.
3. Write a c program for binary search using recursion.
Area and volume


1. Write a c program to find the area of circle.
2. Write a c program to find the area of any triangle.
3. Write a c program to find the area of rectangle.

5. Write a c program to find the area of trapezium.          
6. Write a c program to find the area of right angle triangle.        
7. Write a c program to find the volume and surface area of cube.
8. Write a c program to find the surface area and volume of a cone.
9. Write a c program to find the perimeter of a circle, rectangle and triangle.


Find Answers at C INTERVIEW QUESTIONS

C Program to reverse an Array



#include<stdio.h>
#include<conio.h>
int main()
 {
  int arr[10];
  int i,t;
  clrscr();
  printf("Enter 10 Values:");
  for(i=0;i<10;i++)
  scanf("%d",&arr[i]);
  for(i=0;i<10/2;i++)
  {
    t=arr[i];
     arr[i]=arr[10-i-1];
    arr[10-i-1]=t;
  }
  printf("\nReverse Array List: ");
  for(i=0;i<10;i++)
  printf("%d ",arr[i]);
  getch();
  return 0;
 
}