Skip to content

Category Archives: C Quiz

In the context of the following printf() in C, pick the best statement. i) printf("%d",8); ii) printf("%d",090); iii) printf("%d",00200); iv) printf("%d",0007000); (A) Only i) would… Read More
In the context of C data types, which of the followings is correct? (A) “unsigned long long int” is a valid data type. (B) “long… Read More
Consider the following variable declarations and definitions in C i) int var_9 = 1; ii) int 9_var = 2; iii) int _ = 3; Choose… Read More
#include "stdio.h"  int main() {  void *pVoid;  pVoid = (void*)0;  printf("%lu",sizeof(pVoid));  return 0; } Pick the best statement for the above C program snippet. (A)… Read More
#include "stdlib.h" int main() {  int *pInt;  int **ppInt1;  int **ppInt2;     pInt = (int*)malloc(sizeof(int));  ppInt1 = (int**)malloc(10*sizeof(int*));  ppInt2 = (int**)malloc(10*sizeof(int*));     free(pInt);  free(ppInt1);  free(*ppInt2);… Read More
Assume int is 4 bytes, char is 1 byte and float is 4 bytes. Also, assume that pointer size is 4 bytes (i.e. typical case)… Read More
Suppose that in a C program snippet, followings statements are used. i) sizeof(int); ii) sizeof(int*); iii) sizeof(int**); Assuming size of pointer is 4 bytes and… Read More
#include <stdio.h> #include <string.h> int main() {     char a[] = {'G','E','E','K','S','Q','U','I','Z'};     char b[] = "QUIZ";     char c[] = "GEEKS";     char d[] = "1234";     int l… Read More
Output of Below C Code? Assume that int takes 4 bytes. #include<stdio.h> int x = 5; int main() {     int arr[x];     static int x =… Read More
#include <stdio.h> #include <stdlib.h> int top=0; int fun1() {     char a[]= {'a','b','c','(','d'};     return a[top++]; } int main() {     char b[10];     char ch2;     int i =… Read More
Output of following C program? Assume that all necessary header files are included int main() {     char *s1 = (char *)malloc(50);     char *s2 = (char… Read More
Assume the following C variable declaration int *A [10], B [10][10]; Of the following expressions I. A [2] II. A [2][3] III. B [1] IV.… Read More
Predict the output of following C program #include<stdio.h> struct Point {   int x, y, z; };    int main() {   struct Point p1 = {.y… Read More
Output of following program? #include<stdio.h> int main() {     float x = 0.1;     if ( x == 0.1 )         printf("IF");     else if (x == 0.1f)         printf("ELSE… Read More
Consider the following C program, which variable has the longest scope? int a; int main() {    int b;    // ..    // .. } int c;… Read More

Start Your Coding Journey Now!