My Courses

  • C Programming Questions and Answers – Float Datatype

    C Programming Questions and Answers – Float Datatype   1.The number of digits present after decimal in float is________. a)1 b)3 c)6 d)16 2.Which among the following is never possible as an output for float? a)3.666666 b)3.666 c)3 d)None of the mentioned 3.In a 32-bit compiler, which 2 types have same size? a)char and short…

  • C Programming Questions and Answers – Random Number Generation

    C Programming Questions and Answers – Random Number Generation   1.The function srand(unsigned) a) Sets the seed for rand b) Doesn’t exist c) Is an error d) None of the mentioned 2.Which is the best way to generate numbers between 0 to 99? a) rand()-100 b) rand()%100 c) rand(100) d) srand(100) 3.The correct way to…

  • C Programming Questions and Answers – Mathematical Functions 

    C Programming Questions and Answers – Mathematical Functions   1.What is the output of this C code? #include <stdio.h> #include <math.h> int main() { int i = 90; printf(“%f\n”, sin(i)); return 0; } a) Compile time error b) Undefined behaviour c) 0.893997 d) 1.000000 2.What is the output of this C code? #include <stdio.h> #include…

  • C Programming Questions and Answers – Storage Management

    C Programming Questions and Answers – Storage Management   1.The function ____ obtains block of memory dynamically. a) calloc b) malloc c) Both a & b d) free 2.void * malloc(size_t n) returns a) Pointer to n bytes of uninitialized storage b) NULL if the request cannot be satisfied c) Nothing d) Both a &…

  • C Programming Questions and Answers – Ungetc

    C Programming Questions and Answers – Ungetc   1.ungetc can be used only with getc. a) true b) false c) Depends on the standard d) Depends on the platform 2.Which character of pushback is guaranteed per file? a) true b) false c) Depends on the compiler d) Depends on the platform 3.What is the output…

  • C Programming Questions and Answers – Character Class Testing & Conversions

    C Programming Questions and Answers – Character Class Testing & Conversions   1.Which of the following library function is not case-sensitive? a) toupper() b) tolower() c) isdigit() d) All of the mentioned 2.The following expression can be substituted for. if (isalpha(c) && isdigit(c)) a) if (isalnum(c)) b) if (isalphanum(c)) c) if (isalphanumeric(c)) d) None of…

  • C Programming Questions and Answers – String Operations

    C Programming Questions and Answers – String Operations   1.What is the output of this C code? #include <stdio.h> int main() { char *str = “hello, world”; char *str1 = “hello, world”; if (strcmp(str, str1)) printf(“equal”); else printf(“unequal”); } a) equal b) unequal c) Compilation error d) Depends on the compiler 2.What is the output…

  • C Programming Questions and Answers – Line Input & Output

    C Programming Questions and Answers – Line Input & Output   1.The syntax of fgets is char *fgets(char *line, int maxline, FILE *fp).which is true for fgets.fgets a) returns line on success b) On end of file or error it returns NULL. c) Nothing d) Both a & b 2.fputs function writes a string to…

  • C Programming Questions and Answers – Error Handling 

    C Programming Questions and Answers – Error Handling   1.What is the output of this C code if there is no error in stream fp? #include <stdio.h> int main() { FILE *fp; fp = fopen(“newfile”, “w”); printf(“%d\n”, ferror(fp)); return 0; } a) Compilation error b) 0 c) 1 d) Any nonzero value 2.Within main, return…

  • C Programming Questions and Answers – File Access

    C Programming Questions and Answers – File Access   1.The first and second arguments of fopen are a) A character string containing the name of the file & the second argument is the mode. b) A character string containing the name of the user & the second argument is the mode. c) A character string…

Back to top button