Your browser does not support JavaScript!'

Input and Output streams in C language ~ CSBoxer

Welcome to CSBoxer, as you guys know. CSBoxer is all Computer Science's fundamentals.
All published articles are organized in simple, easy, and short English sentences to familiarize the students with computer science.
In that respect today's article is Input and Output streams in C language


Today's Topic
Input and Output streams in C language


Q1) Which programming structure executes program statements in order:

  1. Relation
  2. Decision
  3. Sequence
  4. Repetition

Answer:Sequence

Explanation:The programming structure that executes program statements in order is called a "sequential" structure or "sequential execution".

Q2) The function that is used to display output on scareen is called:

  1. Scanf
  2. Display
  3. Pow
  4. Printf

Answer:Printf

Explanation:The function that is commonly used to display output on the screen is called "printf()" function. The print() function is a built-in function in most programming languages, including Python, C++, and others.

Q3) Which character signifies the beginning of an escape sequence?

  1. {
  2. /
  3. *
  4. \

Answer:\

Explanation:The backslash "" character signifies the beginning of an escape sequence in most programming languages.

Q4) Which escape sequence moves the cursor at the beginning of current line?

  1. \b
  2. \a
  3. \n
  4. \r

Answer:\r

Explanation:The escape sequence "\r" (carriage return) moves the cursor at the beginning of the current line without advancing to the next line.

Q5) The ASCII code for escape key:

  1. 27
  2. 30
  3. 28
  4. 29

Answer:27

Explanation:The ASCII code for the escape key is 27 (decimal) or 0x1B (hexadecimal). The escape key is commonly used in computer systems to signal an escape sequence or to cancel a command or operation.

Q6) The function getch ( ) is defined in:

  1. Stdio.h
  2. Conio.h
  3. Math.h
  4. String.h

Answer: Conio.h

Explanation: The function "getch()" is not part of the standard C or C++ library, but it is commonly used in some versions of the libraries provided by specific operating systems.

Q7) The escape sequence for tab is:

  1. \
  2. \b
  3. \n
  4. \t

Answer:\t

Explanation:The escape sequence for tab is "\t".
In programming languages and various text editors, "\t" is used to represent the horizontal tab character. When this escape sequence is encountered in a string or a character literal, it instructs the program or the text editor to insert a horizontal tab character into the output or the document, respectively.

Q8) Which escape sequence is used to begin new line?

  1. \a
  2. \n
  3. \m
  4. \b

Answer: \n

Explanation:The escape sequence used to begin a new line in many programming languages and computer systems is "\n" (backslash followed by the letter "n").

Q9) Which of the following format specifier is used for string?

  1. % f
  2. %d
  3. %c
  4. %s

Answer:%s

Explanation:In C-style formatting, the format specifier used for strings is "%s".

  1. char name[20] = "Alice";
  2. printf("Hello, %s!\n", name);

Q10) The general form of format specifier for floating point value is:

  1. % maf
  2. m.n%f
  3. m%n.f
  4. m%nf

Answer:m.n%f

Explanation:"m.n%f"
The general form of the format specifier for a floating-point value in C-style formatting is "%f".

Q11) Which of the following things are determined by format specifier?

  1. Data Type
  2. Format of the value
  3. Field Width
  4. All of these

Answer: Format of the value

Explanation:The format specifier determines how a value is displayed or formatted when printed to the console or output stream. It specifies the type of data that is being formatted and how it should be displayed.

Q12) Stdio stands for:

  1. Standard Input output
  2. Simple Input output
  3. String Input output
  4. Start Input output

Answer: Standard Input output

Explanation: Standard Input output

Q13) An ampersand (&) before the name of the variable name, denotes:

  1. Actual value
  2. Variabie name
  3. Data type
  4. Address

Answer:Address

Explanation:In some programming languages like C and C++, an ampersand symbol (&) before a variable name is used to obtain the memory address of the variable. This is known as the "address-of" operator.

Q14) Which is the output fanction in C program?

  1. Printf()
  2. gets()
  3. Scanf()
  4. getch()

Answer:Printf()

Explanation:In C programming language, the printf() function is commonly used for output. The printf() function allows you to print formatted text to the console or output stream.

Q15) Format specifier starts with symbol:

  1. %
  2. *
  3. 21

Answer:%

Explanation:The format specifier consists of the "%" symbol followed by one or more conversion characters that specify the type and format of the data being printed.

Q16) Printf(); is a _________ Function in C.

  1. Built in
  2. Local.
  3. User defined
  4. Keyword

Answer:Built in

Explanation:A built-in function, also known as a library function or standard function, is a function that is already provided as part of the programming language or programming environment.

Q17) How many variables can be used in one printf function?

  1. One
  2. Two
  3. Ten
  4. Many

Answer:Many

Explanation:There is no specific limit to the number of variables that can be used in a single printf() function in C programming. However, the number of variables that can be used in a printf() statement is limited by the available memory and the capacity of the output buffer.

Q18) The Format specifier %u is used for:

  1. Unsigned decimal Integer
  2. Unsigned float
  3. Unsigned short
  4. Unsigned long int

Answer:Unsigned decimal Integer

Explanation:The %u format specifier is implemented for fetching values from the address of a variable having an unsigned decimal integer stored in the memory.

Q19) The Format specifier %f is used for

  1. Character
  2. Integer
  3. Double
  4. Float

Answer:Float

Explanation:The format specifier %f is used for printing floating-point values, such as float and double data types.

Q20) The Format specifier %c Is used for:

  1. Character
  2. Integers
  3. Float
  4. Double

Answer:Character

Explanation:The format specifier %c is used to print a single character in C-style formatting.
When used in the printf() function or similar functions, the %c specifier indicates that the argument to be printed should be interpreted as a single character. The argument is expected to be of type char.

Q21) Which of the following format specifier is used for integer data type?

  1. %d
  2. %ec
  3. %s
  4. %f

Answer:%d

Explanation: The format specifier %d is commonly used for integer data type in C-style formatting.
When used in the printf() function or similar functions, the %d specifier indicates that the argument to be printed should be an integer value.

Q22) The escape sequence used to move cursor one character back is:

  1. /a
  2. /n
  3. \b
  4. /b

Answer:/b

Explanation:The escape sequence used to move the cursor one character back is \b in C-style escape sequences.

Q23) What will be the value of x after executing the following code?
For (x = 1; x < 7; x==);
Printf("%d" , x);

  1. infinite 1
  2. 1
  3. 2
  4. 8

Answer:1

Explanation:1 The loop does not modify the value of x, so the value of x remains 1 after the loop terminates.

Q24) Escape sequence \\ is used to print:

  1. New line
  2. Backstash
  3. Space
  4. Tab

Answer:Backstash

Explanation:The escape sequence \\ is used to print a backslash character \ in C-style escape sequences.

Q25) The general form of format specifler for Floating point value is:

  1. m.n%
  2. m.nf
  3. m.n%
  4. m%.nf

Answer: m.n%

Explanation: m.n%

Q26) The escape sequence for carriage return is:

  1. \a
  2. \c
  3. \t
  4. \r

Answer:\r

Explanation:When the escape sequence \r is used in a string, it causes the output to move the cursor back to the beginning of the current line without advancing to the next line. This can be used to overwrite the contents of a line of text.

Q27) Which of the following is not a valid escape code?

  1. \a
  2. \z
  3. \n
  4. \r

Answer:\z

Explanation:\z

Q28) The & symbol in scaf function indicate variable’s i

  1. Value
  2. Access
  3. Address
  4. Data type

Answer:Address

Explanation:The & symbol in the scanf() function is called the "address of" operator and is used to pass the memory address of a variable to the function.

Q29) The statement scanf("%c", & km); Km is a/an.

  1. integer variable
  2. String variable
  3. Character variable
  4. Float variable

Answer:Character variable

Explanation:Character variable

Q30) getch () stands for: (C) (D)

  1. get character
  2. Give character
  3. go Character
  4. All of these

Answer:get character

Explanation:getch() is a function in the C programming language that reads a single character from the keyboard without waiting for the user to press the Enter key. The name "getch" stands for "get character".

Post a Comment

0 Comments

^