Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Programming Questions
In the following C program, an array of character pointers is declared: main() { char *str[] = { "Frogs", "Do", "Not", "Die", "They", "Croak!" }; printf("%d %d", sizeof(str), sizeof(str[0])); } How can you compute how many strings are stored in the array str?
Point out the error, if any, in the following C program that reads characters from a file: #include "stdio.h" int main() { unsigned char; FILE *fp; fp = fopen("trail", "r"); while ((ch = getc(fp)) != EOF) printf("%c", ch); fclose(fp); return 0; }
In the following C program that uses variable arguments, what is the main error? #include "stdarg.h" int main() { 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); } }
In legacy 16-bit C compilers that support near, far and huge pointer types, consider the following 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", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3)); return 0; } Assuming a memory model where far and huge pointers are 4 bytes and near pointers are 2 bytes, what is the output?
In C programming, what is memmove used for and how should it be applied correctly?
Consider the following C program: #include <stdio.h> int main() { int a = 10; void *p = &a; int *ptr = p; printf("%u", *ptr); return 0; } What output does this program produce on a typical system where int is 4 bytes?
Consider the following C program: #include <stdio.h> struct student { int roll; int cgpa; int sgpa[8]; }; int main() { struct student s = { 12, 8, 7, 2, 5, 9 }; int *ptr; ptr = (int *)&s; printf("%d", *(ptr + 3)); return 0; } What value is printed by this program on a typical system where int values are stored consecutively without padding between struct members?
In C programming, what is a simple and common way to check whether a given integer number is a palindrome?
In C programming, to compute the sum of the main diagonal elements of a square matrix stored as a two dimensional array, which of the following approaches is correct?
Consider the following C program that uses a goto inside a for loop: #include <stdio.h> int main() { int i = 0, k; if (i == 0) goto label; for (k = 0; k < 3; k++) { printf("hi "); label: k = printf("%03d", i); } return 0; } What does this program print on the screen?
In C, how can you rewrite the following conditional expression so that the constant 30 appears only once? a <= 20 ? b = 30 : c = 30;
Consider the following C program: #include <stdio.h> int main() { int i = -3, j = 2, k = 0, m; m = ++j && ++i || ++k; printf("%d %d %d %d", i, j, k, m); return 0; } What values are printed for i, j, k and m?
In C programming, we want to round off x (a float variable) to an int value. Which of the following expressions correctly rounds x to the nearest integer value and then converts it to int?
In C programming, consider the following macro and program. What would be the output? #define SQR(x) (x * x) int main() { int a, b = 3; a = SQR(b + 2); printf("%d", a); } Assume standard operator precedence and that printf is correctly declared.
In enterprise job scheduling and batch processing, what is Autosys and what is it primarily used for?
In the analysis of algorithms and data structures, what are the two main measures used to evaluate the efficiency of an algorithm?
In a typical programming language (for example, Python), what is the result of evaluating math.floor(3.6)? Assume math has been imported and floor returns the greatest integer less than or equal to its argument.
In C programming, consider the following code: #include
int main(void) { int x = 97; char y = x; printf("%c\ ", y); return 0; } What will this program print on a typical ASCII-based system?
In Java programming, which of the following statements about the use of assertions is correct according to standard Java guidelines?
In Java, methods declared with which keyword cannot be overridden in a subclass?
Prev
1
2
3
4
…
6
Next