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 that uses a do-while loop, how many times is the value of i checked in the loop condition? #include
int main() { int i = 0; do { i++; printf("In while loop\ "); } while (i < 3); return 0; }
In the following C program, what will be printed for the sizes of the pointer variables better and best (assume a 32-bit system)? #include
void main() { char good, *better, *best; printf("%d..%d", sizeof(better), sizeof(best)); }
In the following C program that uses a goto label defined in a different function, what happens when you try to compile it? #include
void fun(void) { here: printf("PP"); } int main(void) { int i = 1; while (i <= 5) { printf("%d", i); if (i > 2) goto here; i++; } return 0; }
In an object oriented language such as Java or C#, for a declaration and call like x = Circle(), which statement about x is most accurate?
In C programming, what is the output of this code that evaluates an expression with the modulus, multiplication and division operators? #include
void main() { int y = 3; int x = 5 % 2 * 3 / 2; printf("Value of x is %d", x); }
In C programming, what is the output of this code that uses the left shift operator on an integer? #include
void main() { int x = 1, z = 3; int y = x << 3; printf("%d\ ", y); }
In the following C program, what happens when you attempt to modify a const int object through a non const pointer? #include
int main(void) { const int x = 5; int *ptrx; ptrx = &x; /* attempt to assign address of const int to non const pointer */ *ptrx = 10; printf("%d", x); return 0; }
In the following C program using a const pointer to char, where does the error occur and why? #include
int main(void) { char mybuf[] = "Zanzibar"; char yourbuf[] = " Zienckewiz"; char * const ptr = mybuf; *ptr = 'a'; ptr = yourbuf; return 0; }
In C programming, what operations are performed by the library style functions atoi(), itoa() and gcvt() when converting between strings and numeric values?
In C and related environments, what is the difference in purpose between the functions rand(), random(), srand() and randomize() when working with pseudo random numbers?
In C programming, what will be the output when you execute the following code that mixes switch case labels with goto? #include
void main() { switch (2) { case 1L: printf("No"); case 2L: printf("%s", "I"); goto Love; case 3L: printf("Please"); case 4L: Love: printf("Hi"); } }
In algorithm design, which of the following best describes what a simple linear search function written in C does when searching an array for a target value?
In C programming, rewrite the following set of statements using the conditional (ternary) operator so that the behavior is preserved: int a = 1, b; if (a > 10) b = 20;
In C programming, consider the following recursive program: main() { printf("Jamboree"); main(); } How many times will the word Jamboree be printed?
In software design and documentation, a macro flowchart is also known as which type of flowchart?
Consider the following Java interface: public abstract interface Frobnicate { public void twiddle(String s); } Which of the following Frob class declarations is correct with respect to this interface?
In expression conversion, convert the following infix expression to its equivalent prefix notation: ((A + B) * C – (D – E) ^ (F + G))
In C and POSIX style systems, what value does the low level read function return when it reaches the end of a file during a read operation?
In the following C program that uses function pointers and console functions, what output is produced on the screen? #include <stdio.h> #include <conio.h> int main() { void (*p)(); int (*q)(); int (*r)(); p = clrscr; q = getch; r = puts; (*p)(); (*r)("www.curioustab.com"); (*q)(); return 0; }
In C programming, consider the following code: main() { char a[] = "Visual C++"; char *b = "Visual C++"; printf(" %d %d", sizeof(a), sizeof(b)); printf(" %d %d", sizeof(*a), sizeof(*b)); } What values are printed by the two printf calls on a typical 32 bit system where char pointers are 4 bytes?
Prev
1
2
3
…
6
Next