Wednesday, September 19, 2018

Computer Science FAQ -Set 6


What do the following declaration signify? char *scr;
Declare the following statement? "An array of three pointers to chars".
What do the following declaration signify? int *ptr[30];
Declare the following statement? "A pointer to an array of three chars".
What do the following declaration signify? char *arr[10];
What do the following declaration signify? int (*pf)();
What will be the output of the program? #include<stdio.h> int main() { char huge *near *far *ptr1; char near *far *huge *ptr2; char far *huge *near *ptr3; printf("%d, %d, %d\n", sizeof(ptr1), sizeof(*ptr2), sizeof(**ptr3)); return 0; }
What will be the output of the program? #include<stdio.h> typedef unsigned long int uli; typedef uli u; int main() { uli a; u b = -1; a = -1; printf("%lu, %lu", a, b); return 0; }
What will be the output of the program in DOS (Compiler - Turbo C)? #include<stdio.h> double i; int main() { (int)(float)(char) i; printf("%d",sizeof(i)); return 0; }
What will be the output of the program under DOS? #include<stdio.h> int main() { char huge *near *far *ptr1; char near *far *huge *ptr2; char far *huge *near *ptr3; printf("%d, %d, %d\n", sizeof(ptr1), sizeof(**ptr2), sizeof(ptr3)); return 0; }
What will be the output of the program? #include<stdio.h> int main() { struct s1 { char *z; int i; struct s1 *p; }; static struct s1 a[] = {{"Nagpur", 1, a+1} , {"Chennai", 2, a+2} , {"Bangalore", 3, a} }; struct s1 *ptr = a; printf("%s,", ++(ptr->z)); printf(" %s,", a[(++ptr)->i].z); printf(" %s", a[--(ptr->p->i)].z); return 0; }
What will be the output of the program? #include<stdio.h> int main() { char huge *near *ptr1; char huge *far *ptr2; char huge *huge *ptr3; printf("%d, %d, %d\n", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3)); return 0; }
What will be the output of the program in Turbo C? #include<stdio.h> int main() { char near *near *ptr1; char near *far *ptr2; char near *huge *ptr3; printf("%d, %d, %d\n", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3)); return 0; }
What will be the output of the program? #include<stdio.h> int main() { char far *near *ptr1; char far *far *ptr2; char far *huge *ptr3; printf("%d, %d, %d\n", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3)); return 0; }
What will be the output of the program in DOS (Compiler - Turbo C)? #include<stdio.h> double i; int main() { (int)(float)(char) i; printf("%d", sizeof((int)(float)(char)i)); return 0; }
What will be the output of the program? #include<stdio.h> int main() { char huge *near *far *ptr1; char near *far *huge *ptr2; char far *huge *near *ptr3; printf("%d, %d, %d\n", sizeof(**ptr1), sizeof(ptr2), sizeof(*ptr3)); return 0; }
What will be the output of the program (in Turbo C under DOS)? #include<stdio.h> int main() { char huge *near *far *ptr1; char near *far *huge *ptr2; char far *huge *near *ptr3; printf("%d, %d, %d\n", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3)); return 0; }
What will be the output of the program? #include<stdio.h> typedef void v; typedef int i; int main() { v fun(i, i); fun(2, 3); return 0; } v fun(i a, i b) { i s=2; float i; printf("%d,", sizeof(i)); printf(" %d", a*b*s); }
Point out the error in the following program (in Turbo C under DOS). #include<stdio.h> union emp { int empno; int age; }; int main() { union emp e = {10, 25}; printf("%d %d", e.empno, e.age); return 0; }
Point out the error in the following program. #include<stdio.h> #include<stdlib.h> int main() { static char *p = (char *)malloc(10); return 0; }
Point out the error in the following program. #include<stdio.h> void display(int (*ff)()); int main() { int show(); int (*f)(); f = show; display(f); return 0; } void display(int (*ff)()) { (*ff)(); } int show() { printf("IndiaBIX"); }
What will be the output of the program? #include<stdio.h> int main() { const char *s = ""; char str[] = "Hello"; s = str; while(*s) printf("%c", *s++); return 0; }
What will be the output of the program? #include<stdio.h> int get(); int main() { const int x = get(); printf("%d", x); return 0; } int get() { return 20; }
What will be the output of the program (in Turbo C)? #include<stdio.h> int fun(int *f) { *f = 10; return 0; } int main() { const int arr[5] = {1, 2, 3, 4, 5}; printf("Before modification arr[3] = %d", arr[3]); fun(&arr[3]); printf("\nAfter modification arr[3] = %d", arr[3]); return 0; }
What will be the output of the program? #include<stdio.h> int main() { const int i=0; printf("%d\n", i++); return 0; }
What will be the output of the program? #include<stdio.h> int main() { const c = -11; const int d = 34; printf("%d, %d\n", c, d); return 0; }
What will be the output of the program? #include<stdio.h> int main() { int y=128; const int x=y; printf("%d\n", x); return 0; }
What will be the output of the program? #include<stdio.h> #include<stdlib.h> union employee { char name[15]; int age; float salary; }; const union employee e1; int main() { strcpy(e1.name, "K"); printf("%s %d %f", e1.name, e1.age, e1.salary); return 0; }
What will be the output of the program? #include<stdio.h> int fun(int **ptr); int main() { int i=10; const int *ptr = &i; fun(&ptr); return 0; } int fun(int **ptr) { int j = 223; int *temp = &j; printf("Before changing ptr = %5x\n", *ptr); const *ptr = temp; printf("After changing ptr = %5x\n", *ptr); return 0; }
What will be the output of the program? #include<stdio.h> int main() { const int x=5; const int *ptrx; ptrx = &x; *ptrx = 10; printf("%d\n", x); return 0; }
What will be the output of the program in TurboC? #include<stdio.h> int fun(int **ptr); int main() { int i=10, j=20; const int *ptr = &i; printf(" i = %5X", ptr); printf(" ptr = %d", *ptr); ptr = &j; printf(" j = %5X", ptr); printf(" ptr = %d", *ptr); return 0; }
Point out the error in the program. #include<stdio.h> int main() { const int k=7; int *const q=&k; printf("%d", *q); return 0; }
Point out the error in the program. #include<stdio.h> #define MAX 128 int main() { char mybuf[] = "India"; char yourbuf[] = "BIX"; char const *ptr = mybuf; *ptr = 'a'; ptr = yourbuf; return 0; }
Point out the error in the program. #include<stdio.h> const char *fun(); int main() { *fun() = 'A'; return 0; } const char *fun() { return "Hello"; }
Point out the error in the program. #include<stdio.h> #define MAX 128 int main() { char mybuf[] = "India"; char yourbuf[] = "BIX"; char *const ptr = mybuf; *ptr = 'a'; ptr = yourbuf; return 0; }
Point out the error in the program (in Turbo-C). #include<stdio.h> #define MAX 128 int main() { const int max=128; char array[max]; char string[MAX]; array[0] = string[0] = 'A'; printf("%c %c\n", array[0], string[0]); return 0; }
Point out the error in the program. #include<stdio.h> #include<stdlib.h> union employee { char name[15]; int age; float salary; }; const union employee e1; int main() { strcpy(e1.name, "K"); printf("%s", e1.name); e1.age=85; printf("%d", e1.age); printf("%f", e1.salary); return 0; }
Point out the error in the program. #include<stdio.h> const char *fun(); int main() { char *ptr = fun(); return 0; } const char *fun() { return "Hello"; }
Point out the error in the program. #include<stdio.h> int main() { const int x; x=128; printf("%d\n", x); return 0; }
How many times "IndiaBIX" is get printed? #include<stdio.h> int main() { int x; for(x=-1; x<=10; x++) { if(x < 5) continue; else break; printf("IndiaBIX"); } return 0; }
How many times the while loop will get executed if a short int is 2 byte wide? #include<stdio.h> int main() { int j=1; while(j <= 255) { printf("%c %d\n", j, j); j++; } return 0; }
Which of the following is not logical operator?
In mathematics and computer programming, which is the correct order of mathematical operators ?
Which of the following cannot be checked in a switch-case statement?
By default a real number is treated as a
Which of the following is not user defined data type? 1 : struct book { char name[10]; float price; int pages; }; 2 : long int l = 2.35; 3 : enum day {Sun, Mon, Tue, Wed};
Is the following statement a declaration or definition? extern int i;
Identify which of the following are declarations 1 : extern int x; 2 : float square ( float x ) { ... } 3 : double pow(double, double);
In the following program where is the variable a getting defined and where it is getting declared? #include<stdio.h> int main() { extern int a; printf("%d\n", a); return 0; } int a=20;
When we mention the prototype of a function?
Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?
What are the types of linkages?
Which of the following special symbol allowed in a variable name?
Is there any difference between following declarations? 1 : extern int fun(); 2 : int fun();
How would you round off a value from 1.66 to 2.0?
What will be the output of the program? #include<stdio.h> int X=40; int main() { int X=20; printf("%d\n", X); return 0; }
What is the output of the program #include<stdio.h> int main() { int x = 10, y = 20, z = 5, i; i = x < y < z; printf("%d\n", i); return 0; }
What is the output of the program #include<stdio.h> int main() { extern int fun(float); int a; a = fun(3.14); printf("%d\n", a); return 0; } int fun(int aa) { return (int)++aa; }
What is the output of the program #include<stdio.h> int main() { int a[5] = {2, 3}; printf("%d, %d, %d\n", a[2], a[3], a[4]); return 0; }
What is the output of the program? #include<stdio.h> int main() { union a { int i; char ch[2]; }; union a u; u.ch[0] = 3; u.ch[1] = 2; printf("%d, %d, %d\n", u.ch[0], u.ch[1], u.i); return 0; }
In the following program how long will the for loop get executed? #include<stdio.h> int main() { int i=5; for(;scanf("%s", &i); printf("%d\n", i)); return 0; }
What will be the output of the program? #include<stdio.h> int main() { int X=40; { int X=20; printf("%d ", X); } printf("%d\n", X); return 0; }
What is the output of the program given below ? #include<stdio.h> int main() { enum status { pass, fail, atkt}; enum status stud1, stud2, stud3; stud1 = pass; stud2 = atkt; stud3 = fail; printf("%d, %d, %d\n", stud1, stud2, stud3); return 0; }
What will be the output of the program in 16 bit platform (Turbo C under DOS)? #include<stdio.h> int main() { extern int i; i = 20; printf("%d\n", sizeof(i)); return 0; }
What is the output of the program? #include<stdio.h> int main() { extern int a; printf("%d\n", a); return 0; } int a=20;
What is the output of the program in Turbo C (in DOS 16-bit OS)? #include<stdio.h> int main() { char *s1; char far *s2; char huge *s3; printf("%d, %d, %d\n", sizeof(s1), sizeof(s2), sizeof(s3)); return 0; }
What is the output of the program #include<stdio.h> int main() { struct emp { char name[20]; int age; float sal; }; struct emp e = {"Tiger"}; printf("%d, %f\n", e.age, e.sal); return 0; }
Which of the declaration is correct?
Which of the following operations are INCORRECT?
Which of the following correctly represents a long double constant?
Which of the structure is incorrcet? 1 : struct aa { int a; float b; }; 2 : struct aa { int a; float b; struct aa var; }; 3 : struct aa { int a; float b; struct aa *var; };
Which of the structure is correct? 1 : struct book { char name[10]; float price; int pages; }; 2 : struct aa { char name[10]; float price; int pages; } 3 : struct aa { char name[10]; float price; int pages; }
Point out the error in the following program (if it is compiled with Turbo C compiler). #include<stdio.h> int main() { display(); return 0; } void display() { printf("IndiaBIX.com"); }
Point out the error in the following program. #include<stdio.h> int main() { void v = 0; printf("%d", v); return 0; }
Point out the error in the following program. #include<stdio.h> struct emp { char name[20]; int age; }; int main() { emp int xx; int a; printf("%d\n", &a); return 0; }
Which of the following is correct about err used in the declaration given below? typedef enum error { warning, test, exception } err;
Point out the error in the following program. #include<stdio.h> int main() { int (*p)() = fun; (*p)(); return 0; } int fun() { printf("IndiaBix.com\n"); return 0; }
Which of the following is the correct order of evaluation for the below expression? z = x + y * z / 4 % 2 - 1
Which of the following correctly shows the hierarchy of arithmetic operations in C?
Which of the following is the correct usage of conditional operators used in C?
Which of the following is the correct order if calling functions in the below code? a = f1(23, 14) * f2(12/4) + f3();
Which of the following are unary operators in C? 1. ! 2. sizeof 3. ~ 4. &&
We want to round off x, a float, to an int value, The correct way to do is
The binary equivalent of 5.375 is
A float occupies 4 bytes. If the hexadecimal equivalent of these 4 bytes are A, B, C and D, then when this float is stored in memory in which of the following order do these bytes gets stored?
What will you do to treat the constant 3.14 as a float?
Which of the following statement obtains the remainder on dividing 5.5 by 1.3 ?
What are the different types of real data type in C ?
What will you do to treat the constant 3.14 as a long double?
If the binary eauivalent of 5.375 in normalised form is 0100 0000 1010 1100 0000 0000 0000 0000, what will be the output of the program (on intel machine)? #include<stdio.h> #include<math.h> int main() { float a=5.375; char *p; int i; p = (char*)&a; for(i=0; i<=3; i++) printf("%02x\n", (unsigned char)p[i]); return 0; }
Which of the following range is a valid long double (Turbo C in 16 bit DOS OS) ?
Which statement will you add in the following program to work it correctly? #include<stdio.h> int main() { printf("%f\n", log(36.0)); return 0; }
What will be the output of the program? #include<stdio.h> int main() { float f=43.20; printf("%e, ", f); printf("%f, ", f); printf("%g", f); return 0; }
What will be the output of the program? #include<stdio.h> int main() { float a=0.7; if(a < 0.7f) printf("C\n"); else printf("C++\n"); return 0; }
What will be the output of the program? #include<stdio.h> #include<math.h> int main() { float n=1.54; printf("%f, %f\n", ceil(n), floor(n)); return 0; }
What will be the output of the program? #include<stdio.h> int main() { float d=2.25; printf("%e,", d); printf("%f,", d); printf("%g,", d); printf("%lf", d); return 0; }
What will be the output of the program? #include<stdio.h> int main() { float a=0.7; if(a < 0.7) printf("C\n"); else printf("C++\n"); return 0; }
What will be the output of the program? #include<stdio.h> int main() { float *p; printf("%d\n", sizeof(p)); return 0; }
What will be the output of the program? #include<stdio.h> int main() { float fval=7.29; printf("%d\n", (int)fval); return 0; }
What will be the output of the program? #include<stdio.h> #include<math.h> int main() { printf("%f\n", sqrt(36.0)); return 0; }
What will be the output of the program? #include<stdio.h> #include<math.h> int main() { printf("%d, %d, %d\n", sizeof(3.14f), sizeof(3.14), sizeof(3.14l)); return 0; }
The keyword used to transfer control from a function back to the calling function is
What is the notation for following functions? 1. int f(int a, float b) { /* Some code */ } 2. int f(a, b) int a; float b; { /* Some code */ }
How many times the program will print "IndiaBIX" ? #include<stdio.h> int main() { printf("IndiaBIX"); main(); return 0; }
Which of the following statements are correct about the program? #include<stdio.h> int main() { printf("%p\n", main()); return 0; }
There is a error in the below program. Which statement will you add to remove it? #include<stdio.h> int main() { int a; a = f(10, 3.14); printf("%d\n", a); return 0; } float f(int aa, float bb) { return ((float)aa + bb); }
Which of the following statements are correct about the function? long fun(int num) { int i; long f=1; for(i=1; i<=num; i++) f = f * i; return f; }
Point out the error in the program f(int a, int b) { int a; a = 20; return a; }
Point out the error in the program #include<stdio.h> int f(int a) { a > 20? return(10): return(20); } int main() { int f(int); int b; b = f(20); printf("%d\n", b); return 0; }
Point out the error in the program #include<stdio.h> int main() { int a=10; void f(); a = f(); printf("%d\n", a); return 0; } void f() { printf("Hi"); }
Which files will get closed through the fclose() in the following program? #include<stdio.h> int main() { FILE *fs, *ft, *fp; fp = fopen("A.C", "r"); fs = fopen("B.C", "r"); ft = fopen("C.C", "r"); fclose(fp, fs, ft); return 0; }
On executing the below program what will be the contents of 'target.txt' file if the source file contains a line "To err is human"? #include<stdio.h> int main() { int i, fss; char ch, source[20] = "source.txt", target[20]="target.txt", t; FILE *fs, *ft; fs = fopen(source, "r"); ft = fopen(target, "w"); while(1) { ch=getc(fs); if(ch==EOF) break; else { fseek(fs, 4L, SEEK_CUR); fputc(ch, ft); } } return 0; }
To scan a and b given below, which of the following scanf() statement will you use? #include<stdio.h> float a; double b;
Out of fgets() and gets() which function is safe to use?
Consider the following program and what will be content of t? #include<stdio.h> int main() { FILE *fp; int t; fp = fopen("DUMMY.C", "w"); t = fileno(fp); printf("%d\n", t); return 0; }
In a file contains the line "I am a boy\r\n" then on reading this line into the array str using fgets(). What will str contain?
What is the purpose of "rb" in fopen() function used below in the code? FILE *fp; fp = fopen("source.txt", "rb");
What does fp point to in the program ? #include<stdio.h> int main() { FILE *fp; fp=fopen("trial", "r"); return 0; }
Which of the following operations can be performed on the file "NOTES.TXT" using the below code? FILE *fp; fp = fopen("NOTES.TXT", "r+");
To print out a and b given below, which of the following printf() statement will you use? #include<stdio.h> float a=3.14; double b=3.14;
What is the purpose of fflush() function.
Can you use the fprintf() to display the output on the screen?
What will the function randomize() do in Turbo C under DOS?
What will the function rewind() do?
Input/output function prototypes and macros are defined in which header file?
Which standard library function will you use to find the last occurance of a character in a string in C?
What is stderr ?
Does there any function exist to convert the int or float to a string?
What will be the output of the program? #include<stdio.h> #include<string.h> int main() { char dest[] = {97, 97, 0}; char src[] = "aaa"; int i; if((i = memcmp(dest, src, 2))==0) printf("Got it"); else printf("Missed"); return 0; }
What will function gcvt() do?
What will be the output of the program? #include<stdio.h> int main() { int i; char c; for(i=1; i<=5; i++) { scanf("%c", &c); /* given input is 'a' */ printf("%c", c); ungetc(c, stdin); } return 0; }
What will be the output of the program? #include<stdio.h> int main() { int i; i = printf("How r u\n"); i = printf("%d\n", i); printf("%d\n", i); return 0; }
What will be the output of the program? #include<stdio.h> #include<math.h> int main() { float i = 2.5; printf("%f, %d", floor(i), ceil(i)); return 0; }
What will be the output of the program? #include<stdio.h> int main() { int i; i = scanf("%d %d", &i, &i); printf("%d\n", i); return 0; }
What will be the output of the program? #include<stdio.h> int main() { int i; char c; for(i=1; i<=5; i++) { scanf("%c", &c); /* given input is 'b' */ ungetc(c, stdout); printf("%c", c); ungetc(c, stdin); } return 0; }
What will be the output of the program? #include<stdio.h> #include<stdlib.h> int main() { char *i = "55.555"; int result1 = 10; float result2 = 11.111; result1 = result1+atoi(i); result2 = result2+atof(i); printf("%d, %f", result1, result2); return 0; }
Point out the error in the following program. #include<stdio.h> int main() { fprintf("IndiaBIX"); printf("%.ef", 2.0); return 0; }
Point out the error in the following program. #include<stdio.h> #include<string.h> int main() { char str1[] = "Learn through IndiaBIX\0.com", str2[120]; char *p; p = (char*) memccpy(str2, str1, 'i', strlen(str1)); *p = '\0'; printf("%s", str2); return 0; }
Point out the error in the following program. #include<stdio.h> int main() { char str[] = "IndiaBIX"; printf("%.#s %2s", str, str); return 0; }
Which header file should be included to use functions like malloc() and calloc()?
What function should be used to free the memory allocated by calloc() ?
How will you free the memory allocated by the following program? #include<stdio.h> #include<stdlib.h> #define MAXROW 3 #define MAXCOL 4 int main() { int **p, i, j; p = (int **) malloc(MAXROW * sizeof(int*)); return 0; }
Specify the 2 library functions to dynamically allocate memory?
Assume integer is 2 bytes wide. What will be the output of the following code? #include<stdio.h> #include<stdlib.h> #define MAXROW 3 #define MAXCOL 4 int main() { int (*p)[MAXCOL]; p = (int (*) [MAXCOL])malloc(MAXROW *sizeof(*p)); printf("%d, %d\n", sizeof(p), sizeof(*p)); return 0; }
How many bytes of memory will the following code reserve? #include<stdio.h> #include<stdlib.h> int main() { int *p; p = (int *)malloc(256 * 256); if(p == NULL) printf("Allocation failed"); return 0; }
What will be the output of the program? #include<stdio.h> #include<stdlib.h> int main() { int *p; p = (int *)malloc(20); /* Assume p has address of 1314 */ free(p); printf("%u", p); return 0; }
What will be the output of the program (16-bit platform)? #include<stdio.h> #include<stdlib.h> int main() { int *p; p = (int *)malloc(20); printf("%d\n", sizeof(p)); free(p); return 0; }
What will be the output of the program? #include<stdio.h> #include<string.h> int main() { char *s; char *fun(); s = fun(); printf("%s\n", s); return 0; } char *fun() { char buffer[30]; strcpy(buffer, "RAM"); return (buffer); }
What will be the output of the program? #include<stdio.h> #include<stdlib.h> int main() { union test { int i; float f; char c; }; union test *t; t = (union test *)malloc(sizeof(union test)); t->f = 10.10f; printf("%f", t->f); return 0; }
Assume integer is 2 bytes wide. How many bytes will be allocated for the following code? #include<stdio.h> #include<stdlib.h> #define MAXROW 3 #define MAXCOL 4 int main() { int (*p)[MAXCOL]; p = (int (*) [MAXCOL])malloc(MAXROW *sizeof(*p)); return 0; }
Point out the correct statement will let you access the elements of the array using 'p' in the following program? #include<stdio.h> #include<stdlib.h> int main() { int i, j; int(*p)[3]; p = (int(*)[3])malloc(3*sizeof(*p)); return 0; }
Which of the following statement is correct prototype of the malloc() function in c ?
Point out the correct statement which correctly free the memory pointed to by 's' and 'p' in the following program? #include<stdio.h> #include<stdlib.h> int main() { struct ex { int i; float j; char *s }; struct ex *p; p = (struct ex *)malloc(sizeof(struct ex)); p->s = (char*)malloc(20); return 0; }
Point out the correct statement which correctly allocates memory dynamically for 2D array following program? #include<stdio.h> #include<stdlib.h> int main() { int *p, i, j; /* Add statement here */ for(i=0; i<3; i++) { for(j=0; j<4; j++) { p[i*4+j] = i; printf("%d", p[i*4+j]); } } return 0; }
Point out the error in the following program. #include<stdio.h> #include<stdlib.h> int main() { int *a[3]; a = (int*) malloc(sizeof(int)*3); free(a); return 0; }
Point out the error in the following program. #include<stdio.h> #include<stdlib.h> int main() { char *ptr; *ptr = (char)malloc(30); strcpy(ptr, "RAM"); printf("%s", ptr); free(ptr); return 0; }
What would be the equivalent pointer expression for referring the array element a[i][j][k][l]
A pointer is
The operator used to get value at address stored in a pointer variable is
What is (void*)0?
Can you combine the following two statements into one? char *p; p = (char*) malloc(100);
In which header file is the NULL macro defined?
How many bytes are occupied by near, far and huge pointers (DOS)?
If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?
Which of the following function is more appropriate for reading in a multi-word string?
Which of the following function is correct that finds the length of a string?
Which of the following function sets first n characters of a string to a given character?
If the two strings are identical, then strcmp() function returns
How will you print \n on the screen?
The library function used to find the last occurrence of a character in a string is
Which of the following function is used to find the first occurrence of a given string in another string?
How will you free the allocated memory ?
What is the similarity between a structure, union and enumeration?
What will be the output of the program ? #include<stdio.h> int main() { enum status {pass, fail, absent}; enum status stud1, stud2, stud3; stud1 = pass; stud2 = absent; stud3 = fail; printf("%d %d %d\n", stud1, stud2, stud3); return 0; }
What will be the output of the program ? #include<stdio.h> int main() { int i=4, j=8; printf("%d, %d, %d\n", i|j&j|i, i|j&j|i, i^j); return 0; }
What will be the output of the program in Turbo C (under DOS)? #include<stdio.h> int main() { struct emp { char *n; int age; }; struct emp e1 = {"Dravid", 23}; struct emp e2 = e1; strupr(e2.n); printf("%s\n", e1.n); return 0; }
What will be the output of the program in 16-bit platform (under DOS)? #include<stdio.h> int main() { struct node { int data; struct node *link; }; struct node *p, *q; p = (struct node *) malloc(sizeof(struct node)); q = (struct node *) malloc(sizeof(struct node)); printf("%d, %d\n", sizeof(p), sizeof(q)); return 0; }
What will be the output of the program ? #include<stdio.h> int main() { struct byte { int one:1; }; struct byte var = {1}; printf("%d\n", var.one); return 0; }
What will be the output of the program ? #include<stdio.h> int main() { enum days {MON=-1, TUE, WED=6, THU, FRI, SAT}; printf("%d, %d, %d, %d, %d, %d\n", ++MON, TUE, WED, THU, FRI, SAT); return 0; }
What will be the output of the program ? #include<stdio.h> struct course { int courseno; char coursename[25]; }; int main() { struct course c[] = { {102, "Java"}, {103, "PHP"}, {104, "DotNet"} }; printf("%d ", c[1].courseno); printf("%s\n", (*(c+2)).coursename); return 0; }
What will be the output of the program given below in 16-bit platform ? #include<stdio.h> int main() { enum value{VAL1=0, VAL2, VAL3, VAL4, VAL5} var; printf("%d\n", sizeof(var)); return 0; }
What will be the output of the program ? #include<stdio.h> int main() { union a { int i; char ch[2]; }; union a u; u.ch[0]=3; u.ch[1]=2; printf("%d, %d, %d\n", u.ch[0], u.ch[1], u.i); return 0; }
What will be the output of the program ? #include<stdio.h> int main() { union var { int a, b; }; union var v; v.a=10; v.b=20; printf("%d\n", v.a); return 0; }
What will be the output of the program ? #include<stdio.h> int main() { struct value { int bit1:1; int bit3:4; int bit4:4; }bit={1, 2, 13}; printf("%d, %d, %d\n", bit.bit1, bit.bit3, bit.bit4); return 0; }
What will be the output of the program in 16 bit platform (Turbo C under DOS) ? #include<stdio.h> int main() { struct value { int bit1:1; int bit3:4; int bit4:4; }bit; printf("%d\n", sizeof(bit)); return 0; }
What will be the output of the program ? #include<stdio.h> int main() { enum days {MON=-1, TUE, WED=6, THU, FRI, SAT}; printf("%d, %d, %d, %d, %d, %d\n", MON, TUE, WED, THU, FRI, SAT); return 0; }
Which of the following statements correct about the below program? #include<stdio.h> int main() { struct emp { char name[25]; int age; float sal; }; struct emp e[2]; int i=0; for(i=0; i<2; i++) scanf("%s %d %f", e[i].name, &e[i].age, &e[i].sal); for(i=0; i<2; i++) scanf("%s %d %f", e[i].name, e[i].age, e[i].sal); return 0; }
Which of the following statements correct about the below program? #include<stdio.h> int main() { union a { int i; char ch[2]; }; union a u1 = {512}; union a u2 = {0, 2}; return 0; } 1: u2 CANNOT be initialized as shown. 2: u1 can be initialized as shown. 3: To initialize char ch[] of u2 '.' operator should be used. 4: The code causes an error 'Declaration syntax error'
Which of the following statements correctly assigns 12 to month using pointer variable pdt? #include<stdio.h> struct date { int day; int month; int year; }; int main() { struct date d; struct date *pdt; pdt = &d; return 0; }
Which of the following statements correct about the below code? maruti.engine.bolts=25;
Point out the error in the program? #include<stdio.h> #include<string.h> void modify(struct emp*); struct emp { char name[20]; int age; }; int main() { struct emp e = {"Sanjay", 35}; modify(&e); printf("%s %d", e.name, e.age); return 0; } void modify(struct emp *p) { p ->age=p->age+2; }
Point out the error in the program in 16-bit platform? #include<stdio.h> int main() { struct bits { int i:40; }bit; printf("%d\n", sizeof(bit)); return 0; }
Point out the error in the program? #include<stdio.h> int main() { union a { int i; char ch[2]; }; union a z1 = {512}; union a z2 = {0, 2}; return 0; }
Point out the error in the program? #include<stdio.h> int main() { struct emp { char n[20]; int age; }; struct emp e1 = {"Dravid", 23}; struct emp e2 = e1; if(e1 == e2) printf("The structure are equal"); return 0; }
Point out the error in the program? #include<stdio.h> int main() { struct bits { float f:2; }bit; printf("%d\n", sizeof(bit)); return 0; }
Point out the error in the program? #include<stdio.h> int main() { struct emp { char name[25]; int age; float bs; }; struct emp e; e.name = "Suresh"; e.age = 25; printf("%s %d\n", e.name, e.age); return 0; }
Point out the error in the program? struct emp { int ecode; struct emp *e; };
Point out the error in the program? typedef struct data mystruct; struct data { int x; mystruct *b; };
Point out the error in the program? #include<stdio.h> int main() { struct a { float category:5; char scheme:4; }; printf("size=%d", sizeof(struct a)); return 0; }
Point out the error in the program? struct emp { int ecode; struct emp e; };
Point out the error in the program? #include<stdio.h> int main() { struct emp { char name[20]; float sal; }; struct emp e[10]; int i; for(i=0; i<=9; i++) scanf("%s %f", e[i].name, &e[i].sal); return 0; }
In the following code, the P2 is Integer Pointer or Integer? typedef int *ptr; ptr p1, p2;
In the following code what is 'P'? typedef char *charp; const charp P;
What is x in the following program? #include<stdio.h> int main() { typedef char (*(*arrfptr[3])())[10]; arrfptr x; return 0; }
What will be the output of the program? #include<stdio.h> int main() { enum color{red, green, blue}; typedef enum color mycolor; mycolor m = red; printf("%d", m); return 0; }
What will be the output of the program? #include<stdio.h> int main() { typedef int arr[5]; arr iarr = {1, 2, 3, 4, 5}; int i; for(i=0; i<4; i++) printf("%d,", iarr[i]); return 0; }
What will be the output of the program? #include<stdio.h> int main() { typedef int LONG; LONG a=4; LONG b=68; float c=0; c=b; b+=a; printf("%d,", b); printf("%f\n", c); return 0; }
What will be the output of the program? #include<stdio.h> int main() { typedef float f; static f *fptr; float fval = 90; fptr = &fval; printf("%f\n", *fptr); return 0; }
What will be the output of the program? #include<stdio.h> typedef struct error {int warning, err, exception;} ERROR; int main() { ERROR e; e.err=1; printf("%d\n", e.err); return 0; }
What will be the output of the program? #include<stdio.h> #include<stdarg.h> void fun(char *msg, ...); int main() { fun("IndiaBIX", 1, 4, 7, 11, 0); return 0; } void fun(char *msg, ...) { va_list ptr; int num; va_start(ptr, msg); num = va_arg(ptr, int); num = va_arg(ptr, int); printf("%d", num); }
What will be the output of the program? #include<stdio.h> #include<stdarg.h> void fun1(char, int, int *, float *, char *); void fun2(char ch, ...); void (*p1)(char, int, int *, float *, char *); void (*p2)(char ch, ...); int main() { char ch='A'; int i=10; float f=3.14; char *p="Hello"; p1=fun1; p2=fun2; (*p1)(ch, i, &i, &f, p); (*p2)(ch, i, &i, &f, p); return 0; } void fun1(char ch, int i, int *pi, float *pf, char *p) { printf("%c %d %d %f %s \n", ch, i, *pi, *pf, p); } void fun2(char ch, ...) { int i, *pi; float *pf; char *p; va_list list; printf("%c ", ch); va_start(list, ch); i = va_arg(list, int); printf("%d ", i); pi = va_arg(list, int*); printf("%d ", *pi); pf = va_arg(list, float*); printf("%f ", *pf); p = va_arg(list, char *); printf("%s", p); }
What will be the output of the program? #include<stdio.h> #include<stdarg.h> void dumplist(int, ...); int main() { dumplist(2, 4, 8); dumplist(3, 6, 9, 7); return 0; } void dumplist(int n, ...) { va_list p; int i; va_start(p, n); while(n-->0) { i = va_arg(p, int); printf("%d", i); } va_end(p); printf("\n"); }
What will be the output of the program? #include<stdio.h> #include<stdarg.h> void display(int num, ...); int main() { display(4, 'A', 'B', 'C', 'D'); return 0; } void display(int num, ...) { char c, c1; int j; va_list ptr, ptr1; va_start(ptr, num); va_start(ptr1, num); for(j=1; j<=num; j++) { c = va_arg(ptr, int); printf("%c", c); c1 = va_arg(ptr1, int); printf("%d\n", c1); } }
What will be the output of the program? #include<stdio.h> #include<stdarg.h> void fun1(int num, ...); void fun2(int num, ...); int main() { fun1(1, "Apple", "Boys", "Cats", "Dogs"); fun2(2, 12, 13, 14); return 0; } void fun1(int num, ...) { char *str; va_list ptr; va_start(ptr, num); str = va_arg(ptr, char *); printf("%s ", str); } void fun2(int num, ...) { va_list ptr; va_start(ptr, num); num = va_arg(ptr, int); printf("%d", num); }
Point out the error in the following program. #include<stdio.h> #include<stdarg.h> void display(char *s, ...); void show(char *t, ...); int main() { display("Hello", 4, 12, 13, 14, 44); return 0; } void display(char *s, ...) { show(s, ...); } void show(char *t, ...) { int a; va_list ptr; va_start(ptr, s); a = va_arg(ptr, int); printf("%f", a); }
Point out the error in the following program. #include<stdio.h> #include<stdarg.h> void varfun(int n, ...); int main() { varfun(3, 7, -11.2, 0.66); return 0; } void varfun(int n, ...) { float *ptr; int num; va_start(ptr, n); num = va_arg(ptr, int); printf("%d", num); }
Point out the error in the following program. #include<stdio.h> #include<stdarg.h> fun(...); int main() { fun(3, 7, -11.2, 0.66); return 0; } fun(...) { va_list ptr; int num; va_start(ptr, n); num = va_arg(ptr, int); printf("%d", num); }
Point out the error if any in the following program (Turbo C). #include<stdio.h> #include<stdarg.h> void display(int num, ...); int main() { display(4, 'A', 'a', 'b', 'c'); return 0; } void display(int num, ...) { char c; int j; va_list ptr; va_start(ptr, num); for(j=1; j<=num; j++) { c = va_arg(ptr, char); printf("%c", c); } }
Point out the error in the following program. #include<stdio.h> #include<stdarg.h> void varfun(int n, ...); int main() { varfun(3, 7, -11, 0); return 0; } void varfun(int n, ...) { va_list ptr; int num; num = va_arg(ptr, int); printf("%d", num); }
Point out the error in the following program. #include<stdio.h> #include<stdarg.h> int main() { void display(char *s, int num1, int num2, ...); display("Hello", 4, 2, 12.5, 13.5, 14.5, 44.0); return 0; } void display(char *s, int num1, int num2, ...) { double c; char s; va_list ptr; va_start(ptr, s); c = va_arg(ptr, double); printf("%f", c); }
Point out the error in the following program. #include<stdio.h> #include<stdarg.h> int main() { void display(int num, ...); display(4, 12.5, 13.5, 14.5, 44.3); return 0; } void display(int num, ...) { float c; int j; va_list ptr; va_start(ptr, num); for(j=1; j<=num; j++) { c = va_arg(ptr, float); printf("%f", c); } }
If you want to group the records in the abc database, you could use the Jobcode as the _____.
The Management Information system (MIS) structure with one main computer system is called a
If a calculation is embedded in a form
After you _____ a record, many data management the environments require you to issue a command to save the changes you made.
What is the language used by most of the DBMSs for helping their users to access data?
Data item characteristics that are important in data management include
In SQL, which command is used to make permanent changes made by statements issue since the beginning of a transaction?
Periodically adding, changing and deleting file records is called file
Sort/report generators
The data dictionary tells the DBMS
In SQL, which command(s) is(are) used to enable/disable a database trigger?
If the record management system allows you to edit values before they are recorded on disk, you can
The relational model uses some unfamiliar terminology. A tuple is equivalent to a:
The files stored on a secondary stage device are composed of a hierarchy of data. What does a record in a file contain?
Which command is used to remove an index from the database in SQL?
An-owner-member set in the CODASYL specifications may have
What is the name given to the database management system which is able to handle full text data, image data, audio and video?
A top-to-bottom relationship among the items in a database is established by a
A database management system
Which of the following hardware components is the most important to the operation of a database management system?
The PROJECT command will create new table that has
To have a file hold a list, it is necessary to
Sophisticated report generators can
In a _____ a parent record type can be linked to one or more "child" record types, but a child record type can have only one parent.
Which two files are used during operation of the DBMS?
When using a database management system, the first thing that you must do is to
A network schema
Which of the following is not a relational database?
Which command is used to remove a table from the database in SQL?
A large computer information system maintains many different computer files. Which amongst them is called a perpetual file?
A file produced by a spreadsheet
A form defines
Which of the following is true of a network structure?
In SQL, GRANT command is used to
The highest level in the hierarchy of data organization is called
The logical data structure with a one-to-many relationship is a :
Updating a database means
In SQL, which command(s) is(are) used to enable/disable all triggers on a table?
When you have finished entering information into a form
The main idea behind computer files is that it is convenient to
A list consists of last names, first names, addresses, and pin codes if all people in the list have the same last and the same pin code, a useful key would be
In SQL, which command is used to add new rows to a table?
A number of related records that are treated as a unit is called
A report generator is used to
Which of the following is not a logical data-base structure?
Which of the following is a database administrator
Primitive operations common to all record management systems include
Each of data files has a _____ that describe the way the data is stored in the file.
The way a particular application views the data from the data base that the application uses is a :

No comments:

Post a Comment