Skip to content

Tag Archives: C-Input and Output Quiz

How to input a large number (a number that cannot be stored even in long long int) without spaces? We need this large number in… Read More
fflush() is typically used for output stream only. Its purpose is to clear (or flush) the output buffer and move the buffered data to console… Read More
scanf() : The C library function int scanf (const char *format, …) reads formatted input from stdin. Syntax: int scanf(const char *format, ...) Return type:… Read More
Predict the output of the following C program with a printf inside printf. #include<stdio.h>     int main() {    int x = 1987;    printf("%d", printf("%d", printf("%d",… Read More
Below are some interesting facts about C programming: 1) The case labels of a switch statement can occur inside if-else statements. #include <stdio.h>    int… Read More
Many of us know the traditional uses of scanf. Well, here are some of the lesser known facts How to read only a part of… Read More
Consider below simple program in C. The program reads an integer using scanf(), then reads a string using fgets(). // C program to demonstrate the… Read More
All of these functions read a character from input and return an integer value. The integer is returned to accommodate a special value used to… Read More
printf: printf function is used to print character stream of data on stdout console. Syntax : int printf(const char* str, ...); Example : // simple… Read More
What is the return type of getchar()? (A) int (B) char (C) unsigned char (D) float Answer: (A) Explanation: The return type of getchar() is… Read More
Output of following program? #include<stdio.h> int main() {     printf("%d", printf("%d", 1234));     return 0; } (A) 12344 (B) 12341 (C) 11234 (D) 41234 Answer: (A) Explanation:… Read More
Predict the output of following program? #include <stdio.h> int main(void)  {    int x = printf("GeeksQuiz");    printf("%d", x);    return 0; } (A) GeeksQuiz9 (B) GeeksQuiz10 (C)… Read More
#include<stdio.h>    int main() {     char *s = "Geeks Quiz";     int n = 7;     printf("%.*s", n, s);     return 0; } (A) Geeks Quiz (B) Nothing… Read More
What does the following C statement mean? scanf("%4s", str); (A) Read exactly 4 characters from console. (B) Read maximum 4 characters from console. (C) Read… Read More
Which of the following is true (A) gets() doesn’t do any array bound testing and should not be used. (B) fgets() should be used in… Read More