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 C, consider the call printf("%d", num); where num is of type long int. Why is the compiler often not required by the language standard to issue a type mismatch warning for this call, even though the format string expects an int?
In C, how would you use the standard library function qsort() to sort an array of structures struct student arr[N] in ascending order of the marks field?
In C, what will be the output of the following program that combines a for loop, a while loop, a do while loop and the continue statement? #include
int main(void) { int i; for (i = 10; i <= 15; i++) { while (i) { do { printf("%d ", 1); if (i > 1) continue; } while (0); break; } } return 0; }
In the following C code that declares an enum and uses a switch statement, what output will be produced when the program is executed? #include
enum actor { SeanPenn = 5, AlPacino = -2, GaryOldman, EdNorton }; int main(void) { enum actor a = 0; switch (a) { case SeanPenn: printf("Kevin Spacey"); break; case AlPacino: printf("Paul Giamatti"); break; case GaryOldman: printf("Donald Shuterland"); break; case EdNorton: printf("Johnny Depp"); break; } return 0; }
In C, which of the following small programs best implements a simplified version of the DOS type command that prints the contents of a text file specified on the command line to standard output?
In C control flow, why and when would you choose a do while loop instead of a while loop for a particular piece of logic?
In C, which of the following code snippets correctly swaps the values of two integer variables a and b without using a third temporary variable, while avoiding undefined behaviour for distinct variables?
In C programming, which of the following code fragments correctly generates and prints the first n terms of the Fibonacci series, starting with 0 and 1, where n is read from the user?
In C programming, which of the following functions correctly computes the factorial of a non negative integer n using an iterative approach and returns the result as a long long?
In C, a strong number is a number whose value equals the sum of the factorials of its digits (for example 145 = 1! + 4! + 5!). Which of the following code fragments correctly checks whether an integer n is a strong number and prints an appropriate message?
In C, which of the following code snippets correctly prints the multiplication table of an integer n from 1 × n up to 10 × n after reading n from the user?
In C programming, how does the selection sort algorithm arrange an array of n elements in ascending order?
In C programming, which statement best describes how the quick sort algorithm sorts an array in ascending order?
In C programming, how does the insertion sort algorithm build a sorted array from an unsorted array?
In C programming, which description correctly explains how the merge sort algorithm works?
In C programming, what is the key idea behind the iterative binary search algorithm on a sorted array?
In C programming, what does a standard matrix multiplication program compute when multiplying an m x n matrix A by an n x p matrix B?
In C programming using standard library functions, what does a typical file copy program do when copying data from one file to another?
In the following C program using nested structures, what output is produced on a typical system? struct India { char c; float d; }; struct World { int a[3]; char b; struct India orissa; }; int main() { struct World st = { {1, 2, 3}, 'P', {'q', 1.4f} }; printf("%d\t%c\t%c\t%f", st.a[1], st.b, st.orissa.c, st.orissa.d); return 0; }
What is the output of the following C program? void m() { printf("hi"); } int main() { m(); return 0; }
Prev
1
…
4
5
6
Next