How do we check if a file has reached its end?
What is the output of the following code?
main()
{
char *p="Caritor";
*++p;
printf("%c",*p);
*++p;
printf("%c",*p);
}
The file “iostream” includes
Which of the following is the correct syntax for including a user-defined header file in C++?
Which one of the following options is correct?
Consider the following program:
int f(int *p, int n) { if (n <= 1) return 0; else return max(f(p+1,n-1),p[0]-p[1]); } int main() { int a[] = {3,5,2,6,4}; printf("%d", f(a,5)); }
Note: max(x,y) returns the maximum of x and y. The value printed by this program is
What is the output of the following C program?
int main()
{
struct school
{
int rank;
struct class
{
int strength;
}class1;
}school1;
school1.rank = 1;
school1.class1.strength = 60;
printf("%d %d", school1.rank, school1.class1.strength);
}
Consider the following C program:
# include <stdio.h> int main( ) { int i, j, k = 0; j = 2 * 3 / 4 + 2.0 / 5 + 8 / 5; k -= --j; for (i = 0; i < 5; i++) { switch(i + k) { case 1: case 2: printf("n%d", i + k); case 3: printf("n%d", i + k); default: printf("n%d", i + k); } } return 0; }
The number of times printf statement is executed is __________.
Consider the following C program.
#include <stdio.h> #include <string.h> void printlength (char *s, char *t) { unsigned int c = 0; int len = ((strlen (s) - strlen (t)) > c) ? strlen (s) : strlen (t); printf("%dn", len); } void main() { char *x = "abc"; char *y = "defgh"; printlength(x, y); }
Recall that strlen is defined in string.h as returning a value of type size_t, which is an unsigned int . The output of the program is
What is the output of the following code?
#include<stdio.h>
int main()
{
static int arr[]={0,1,2,3,4};
int *p[]={arr,arr+1,arr+2,arr+3,arr+4};
int **ptr=p;
ptr++;
printf("\n %d %d %d",ptr-p, *ptr-arr, **ptr);
*ptr++;
printf("\n %d %d %d",ptr-p, *ptr-arr, **ptr);
*++ptr;
printf("\n %d %d %d",ptr-p, *ptr-arr, **ptr);
++*ptr;
printf("\n %d %d %d",ptr-p, *ptr-arr, **ptr);
return 0;
}
OnSite
1 Openings
FullTime
Posted 17 days ago