Programming with C Test
An array is defined with the following statement in a file, file1.c int a[ ] = { 1, 2, 3, 4, 5, 6 }; In another file, file2.c, the following code snippet is written to use the array a: e...
By which file function you can position the file pointer in accordance with the current position?
Consider the following code. int i = 4, *j, *k; Which one of the following statements will result in Compilation error?
From which of the following loop or conditional constructs, is "break" used for an early exit?
Given the array: int num[3][4]= { {3,6,9,12}, {15,25,30,35}, {66,77,88,99} }; what would be the output of *(*(num+1))?
Given the array: int num[3][4]= { {3,6,9,12}, {15,25,30,35}, {66,77,88,99} }; what would be the output of *(*(num+1)...
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 Fam...
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 following array: char books[][40]={ "The Little World of Don Camillo", "To Kill a Mockingbird", "My Famil...
Given the operators: 1) * 2) / 3) % What would be the order of precedence?
Identify the incorrect statement.
If a two dimensional array arr[4][10](an array with 4 rows and 10 columns) is to be passed in a function, which of the following would be the valid parameters in the function definition?
In order to read structures/records from a file, which function will you use?
In which area of memory are static variables allocated?
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?
Read the statement below: extern int a; Which of the following statement/s pertaining to the above statement is/are correct?
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?
The declaration int (*p[5])() means:
The declaration int *(*p)[10] indicates:
What does the argv[0] represent?
What does the following function do? int fn(unsigned int x) { int count = 0; for(; x!=0; x&=(x-1)) count++; return count; }
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; return; }
What is the return type of the following function declaration? func(char c);
What is the return value in case a file is not opened successfully by using fopen()?
What is wrong with the following function prototype statement? int func();
What will be printed on the standard output as a result of the following code snippet? int funr(int x, int y) { if(x <= 0) { return y; } else ...
What will be printed on the standard output as a result of the following code snippet? main() { int num = 425; printf("%d", printf("%d", num)); }
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() { 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() { char arr1[] = "REGALINT"; printf("%d,",strlen(arr1)); printf("%d",sizeo...
What will be printed on the standard output as a result of the following code snippet? void main() { int arr[][2] = {1,2,3,4,5,6}; printf("%d",arr[2][1]); }
What will be printed on the standard output as a result of the following code snippet? void main() { int arr[5]={1,2,3,4,5}; printf("%d ", *(arr+4)); }
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 will happen when the following code is executed? { int num; num =0; do {-- num; printf("%d ", num); num++; } while (num >=0); }
What will happen when the following code is executed? void main() { char arr1[] = "REGALINT"; char arr2[10] = "REGALINT"; printf("%d,",sizeof(arr1)); printf("%d",sizeof(arr2)); }
What would be printed on the standard output as a result of the following code snippet? main() { enum {red, green, blue = 0, white}; printf("%d %d %d %d", red, green, blue, white)...
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? #define max(a, b)((a) > (b)?(a):(b)) main() { int a=4, c = 5; printf("%d ", max(a++, c++)); printf("%d %d "...
What would be printed on the standard output as a result of the following code snippet? #define Name Manish main() { printf("My name""Name"); }
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 *str1 = "Hello World"; strcat(str1, '!'); printf("%s", str1);
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);
What would be printed on the standard output as a result of the following code snippet? int Recur(int num) { if(num==1 || num==0) return 1; if(num%2==0) return Recur(num/2)+2; else return Recur(nu...
What would be printed on the standard output as a result of the following code snippet? main( ) { char *str[ ] = { "Manish" "Kumar" "Choudhary" }; printf ( " string1 = %s", str[0] ); printf ( " ...
What would be printed on the standard output as a result of the following code snippet? main() { signed char i = 1; for (; i<=255; i++) printf ("%d ",i); retur...
What would be printed on the standard output as a result of the following code snippet? main() { char *s="Hello World"; char s1[20], s2[20]; int len = sscanf(s,"%s",s1); ...
What would be printed on the standard output as a result of the following code snippet? main() { char option = 5; switch(option) { case '5': ...
What would be printed on the standard output as a result of the following code snippet? main() { int i=5; char option = 5; switch(option) { case '5'...
What would be printed on the standard output as a result of the following code snippet? main() { int n=5, x; x = n++; printf("%d ", x); x = ++n; printf("%d ...
What would be printed on the standard output as a result of the following code snippet? main() { void addup (int b); addup(b); return 0; } int b = 5; void addup (in...
What would be printed on the standard output as a result of the following code snippet? main() { int a[5] = {1,4,5,6,9}; printf("%d ", *a); //Line 1 printf("%d", *++a); //Line 2...
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? void main() { unsigned char a=25; a = ~a; signed char b = 25; b = ~b; printf("%d %d ", a...
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 you use to position the file pointer at the beginning of the file?
Which function will you use to write a formatted output to the file?
Which header file are methods(or macros) isalpha(), islower() a part of?
Which is/are the type/s of memory allocation that needs/need the programmer to take care of memory management?
Which of the following comparison statements will be true if an integer is 16 bits and a long is 32 bits on a machine?
Which of the following declarations of structures is/are valid? 1) struct node { int count; char *word; struct node next; ...
Which of the following file modes would mean read + append?
Which of the following functions is used to extract formatted input from a file?
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 relational operator?
Which of the following is not a storage type?
Which of the following is not a string function?
Which of the following is not a type of operator ?
Which of the following is not a valid mode for opening a file?
Which of the following is the correct way of initializing a two-dimensional array?
Which of the following is/are the correct signature/s of main with command line arguments?
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 of the following statements are correct for the keyword register?
Which of the following statements is valid and correct?
Which of the following statements will result in a compilation error?
Which standard function is used to deallocate memory allocated by the malloc() function?