C Programming Test
From which of the following loop or conditional constructs, is "break" used for an early exit?
Given the following array declaration: int a[2][3][4] what would be the number of elements in array a?
Given the following array: char books[][40]={ "The Little World of Don Camillo", "To Kill a Mockingbird", "My ...
Given the following array: int a[8] = {1,2,3,4,5,6,7,0}; what would be the output of printf("%d",a[4]); ?
Given the operators: 1) * 2) / 3) % What would be the order of precedence?
Identify the incorrect statement.
Is the following statement correct? If not, why not? If yes, what is the size of the array? int array[][3] = { {1,2}, {2,3}, {3,4,2} };
Read the following two declaration statements. 1. #include <stdio.h> 2. #include "stdio.h" Which of the following statements pertaining to the above two statements are correct?
Study the following code where num is an integer array and n is the length of the array: for(i=0;i<n-1;i++) { for(j=i+1;j<n;j++) { ...
Study the following code: int n = 2; int a[n]; What is the error in the above code?
Suppose there is a file a.dat which has to be opened in the read mode using the FILE pointer ptr1, what will be the correct syntax?
What does the argv[0] represent?
What is the function to concatenate two strings?
What is the output of the following program ? main() { int u = 1, v = 3; printf("%d %d",u,v); funct1(&u,&v); printf(" %d %d ",u,v); } void funct1(int *pu, int *pv) { *pu=0; *pv=0; re...
What is wrong with the following statement? int func();
What will be printed on the standard output as a result of the following code snippet? void func() { static int i = 1; int j = 1; i++; j++; printf("%d %d ",i,j); } vo...
What will be printed on the standard output as a result of the following code snippet? void main() { char arr[] = {'R','A','M'}; printf("%d",strlen(arr)); }
What will be printed on the standard output as a result of the following code snippet? void main() { int num1 = 30, num2 = 4; float result; result = (float)(num1/num2); ...
What will be printed on the standard output as a result of the following code snippet? void main() { int i,j,k; i=4; j=30; k=0; k=j++/i++; ++k; printf("%d %d %d",i,j,k); }
What will be the output of following code? int main() { int i; i = 0; for (i = 1; i <2; i++) { i++; printf( "%d", i ); continue; ...
What will be the output of the following program? #include <assert.h> main() { int n = 5; assert(n > 3); //statement 1 n = n+2; assert(n > 7);//statement 2 return 0; }
What would be printed on the standard output as a result of the following code snippet? main() { int u = 1, v = 3; printf("%d %d",u,v); funct1(&u,&v); printf("%d %d ",u,v); } void func...
What would be printed on the standard output as a result of the following code snippet? main() { char *pmessage = "asdfgh"; *pmessage++; printf("%s", pmessage); return 0; }
What would be printed on the standard output as a result of the following code snippet? main() { enum {red, green, blue = 6, white}; printf("%d %d %d %d", red, green, blue, white); return 0; }
What would be printed on the standard output as a result of the following code snippet? main() { int arr[10]; int a = sizeof(arr); printf("%d ",a); return 0; }
What would be printed on the standard output as a result of the following code snippet? #define func(t, a, b) { t temp; temp=a; a=b; b=temp; } main() { int a=3, b=4; float c=4.5, d...
What would be printed on the standard output as a result of the following code snippet? #define max(a, b) ((a) > (b)?(a):(b)) main() { int a=4; float b=4.5; printf("%.2f "...
What would be printed on the standard output as a result of the following code snippet? #include<stdio.h> main() { unsigned char a=255; a = a+1; printf("%d",a); ret...
What would be printed on the standard output as a result of the following code snippet? char i = 'A'; char *j; j = & i; *j = *j + 32; printf("%c",i);
Which file header is to be included for file handling in a C program?
Which function allocates memory and initializes elements to 0?
Which function returns the current pointer position within a file?
Which function will convert a string into a double precision quantity?
Which function will convert a string into an integer?
Which function will you use to write a formatted output to the file?
Which of the following declarations of structures is/are valid? 1) struct node { int count; char *word; struct node next; ...
Which of the following is a function for formatting data in memory?
Which of the following is not a file related function?
Which of the following is not a string function?
Which of the following is not a valid mode for opening a file?
Which of the following sets of conversion statements may result in the loss of data?
Which of the following standard functions is used to close a file?
Which standard function is used to clear memory allocated by the malloc() function?