0% found this document useful (0 votes)
2 views

c assign

The document consists of a series of questions related to C programming, covering topics such as arrays, strings, functions, pointers, memory allocation, and sorting algorithms. Each question seeks to explore fundamental concepts and practical coding scenarios in C. The questions range from basic definitions to code outputs and programming tasks.

Uploaded by

skp10092001
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

c assign

The document consists of a series of questions related to C programming, covering topics such as arrays, strings, functions, pointers, memory allocation, and sorting algorithms. Each question seeks to explore fundamental concepts and practical coding scenarios in C. The questions range from basic definitions to code outputs and programming tasks.

Uploaded by

skp10092001
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Question No.

Question

1} List the characteristics of Arrays.

2} Which in-built string function can be used for Searching inside a given string?

3} How can you read a string through keyboard?

4} State the use of strlen() function in C program.

5} Define Sorting.

6} Define Bubble Sort.

7} What will happen if in a C program you assign a value to an array element whose subscript

exceeds the size of array?

8} What is the Format specifier used to print a String or Character array in C Printf or Scanf function?
9} An array Index starts with?

10} Assuming int is of 4 bytes, what is the size of int arr[15];?

11} In which header file does the atoi() function present.

12} Write down the return value after the operation of function strcmp("can","cnt").

13} How can putchar() be used to print a string.

14} What does the following declaration means int (*ptr)[10]?

15}What will be the output of C Statement if we choose the number 66 in the array, int ary[3][2] =
{{11,22},{33,44},{55,66}};

16} Consider the following C program:

#include <stdio.h>

int jumble(int x, int y){

x=2*x+y;

return x;

int main(){

int x=2, y=5;

y=jumble(y,x);

x=jumble(y,x);

printf(“%d \n”, x);

return 0;

The value printed by the program is ________.


17} What is a use of ‘return’ Keyword?

18} Why is it necessary to give the size of an array in an array declaration?

19} What is the output of the following code?

#include <stdio.h>

int main()

int a[5]= {5,1,15,20,25};

int i,j,m;

i=++a[1];

j=a[1]++;

m=a[i++];

printf("%d %d %d",i,j,m);

return 0;

20} What is the output of the following code?

#include <stdio.h>

int main()

int i=3;

char arr[]= {'I','E','M','K','O','L','K','A','T','A'};

printf("%c", arr[--i]);

return 0;

21} Which keyword is used to transfer control from a function back to the calling function?

22} To which a function pointer points to?

23} What is return type and parameter list in function header?

24} What is meant by function without arguments?

25} What is the output of the following code?

#include <stdio.h>

int main()

{
char *ptr;

char mystring[] = "abcdefg";

ptr = mystring;

ptr += 5;

printf("%s",ptr);

return 0;

26} What is the out put of this C program with arrays and pointers? int main()

int ary[] = {11, 33, 55};

int *p, *q;

p = ary;

q = ary+2;

printf("%d %d",*p, *q);

return 0;

27} Consider the following C program:

#include <stdio.h>

int jumble(int x, int y){

x=2*x+y;

return x;}

int main(){

int x=2, y=5;

y=jumble(y,x);

x=jumble(y,x);

printf(“%d ”, x);

return 0; }

What will be the output of this program?

28} What are the usage of pointers?

29} What is the output of the program?

main() junk(int i, int j){ {


int i=5;j=2; i=i*j; junk(i,j); j=i*j; printf(“\n %d %d”,i,j); }

30} How can you return more than one value from a function?

31} What are the pre-processor directives?

32} What is dynamic memory allocation?

33} Find the output of the following code

#include<stdio.h>

int main()

int i, arr[10];

for(i=0;i<10;i++)

arr[i*2]=1;

for(i=0;i<10;i++)

arr[i*2+1]=-1;

for(i=0;i<10;i++)

printf("\t %d",arr[i]);

return 0;

34} Identify the errors, if any, in the following declaration statements.

a) int marks(10); b) int marks[9+1][6-1];

35} If an array is declared as double arr[50], how many bytes will be allocated to it?

36} If an array is declared as int arr[5][5], how many elements can it store.

37} What is meant by Preprocessor?

38} Consider the following C program:

#include <stdio.h>

int main()

int a[ ] = {2, 4, 6, 8, 10};

int i, sum = 0, *b = a + 4;

for (i = 0; i < 5; i++)

sum = sum + (*b – i) – *(b – i);


printf (“%d\n”, sum);

return 0;

What will be the output of above given C program.

39} #include <stdio.h>

int main(){

int arr[]={1,2,3,4,5,6,7,8,9,0,1,2,5}, *ip=arr+4;

printf(“%d\n”, ip[1]);

return 0;

Write number that will be displayed on execution of the program.

40} Write a C program to find the largest element in an array.

41} Define string. How string is declared and initialized ?

42} Define array.Explain how to declare and initialize 1D array.

43} List the advantages and disadvantages of array.

44} List string handling functions.

45} Write a program to print the array elements in reverse order.

46}What do you mean by compile time initialization? Give suitable example of Compile time

initialization of C Array.

47} Explain the following string handling functions a) strcmp( ) b) getchar() c) strcut()

48} Describe difference between runtime and compile time initialization of array in C program.

49} Write a C program to read and display 5 integer values in 1-D array.

50} Write a C Program to count Vowels in a given string.

51} Write a C Program to Sort the Array in an Ascending Order.

52} What is the output of C program.?

int main()

int a[3] = {10,12,14};

int i=0;

while(i<3) {

printf("%d ", i[a]);


i++;

53} Write a C program to compare two strings.

54} Write a C program to count total number of even and odd elements in an

array.

55} Write a C program to copy string without using strcpy().

56} Write a C program to find the length of a string.

57} Write a C program to count the length of a string without using library function.

58} Write a C program to check whether a string is palindrome or not.

59} Write a C program to find the frequency of a character in C.

60} Write a program to sort an array using Bubble sort.

61} Write a program to find out the number of occurences of each number.

62} Write a program in C to count total number of alphabets, digits and special characters in a string.

63} Write a program to calculate length of a string without using library function?

64} Write a program to check whether a string is palindrome or not? Do not use any library function.

65} Write a C program to read and display values of an 1-D array using pointer.

66} Write a C program to swap the values of two variables using pointer.

67} Write a C program to calculate GCD using recursive function.

68} Write a C program to find fibonacci series using recursion.

69} Write a C program to convert binary to decimal using function.

70} Write a C program to swap two numbers using call by value.

71} Write a C program to perform addition and subtraction of a integer numbers using function.

72} Write a C program to print the address of each element of an 1-D array using pointer.

73} Write a C program using function that computes that compute X^n, where X is any valid number

and n is an integer value.

74} Distinguish between Call by value Call by reference with example.

75} What is function ? Explain the difference between user defined and library functions

76} Write a C program to Add two numbers using Function.

77} Write a program in „C‟ using functions to swap two numbers

78} Write a C-program using function to check whether the given number is prime or not.
79} What is the difference between call by value and call by reference

80} What is recursion explain with suitable example.

81} What is pointer ? Explain how the pointer variable declared and initialized?

82} Explain the C Function with no argument and no return value with an example.

83} What are actual parameters and formal parameters? Illustrate with example

84} Explain function call, function definition and function prototype

85} What is the need for functions in C programming?

86} State the advantages of user defined functions over pre-defined function.

87} What are the steps in writing a function in a program?

88} Write the advantages and disadvantages of recursion

89} Write a C program for factorial using recursion function.

90} Differentiate between Actual Parameters and Formal Parameters.

91} Can a C program be compiled or executed in the absence of a main()?

92} What is Dynamic Memory allocation? Mention the syntax.

93} What do you mean by Dangling Pointer Variable in C Programming?

94} What do you mean by Wild Pointer Variable in C Programming?

95} Write a code to generate random numbers in C Language.

You might also like