Q1) Which programming structure executes program statements in order:
- Relation
- Decision
- Sequence
- 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:
- Scanf
- Display
- Pow
- 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?
- {
- /
- *
- \
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?
- \b
- \a
- \n
- \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:
- 27
- 30
- 28
- 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:
- Stdio.h
- Conio.h
- Math.h
- 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:
- \
- \b
- \n
- \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?
- \a
- \n
- \m
- \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?
- % f
- %d
- %c
- %s
Answer:%s
Explanation:In C-style formatting, the format specifier used for strings is "%s".
- char name[20] = "Alice";
- printf("Hello, %s!\n", name);
Q10) The general form of format specifier for floating point value is:
- % maf
- m.n%f
- m%n.f
- 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?
- Data Type
- Format of the value
- Field Width
- 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:
- Standard Input output
- Simple Input output
- String Input output
- Start Input output
Answer: Standard Input output
Explanation: Standard Input output
Q13) An ampersand (&) before the name of the variable name, denotes:
- Actual value
- Variabie name
- Data type
- 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?
- Printf()
- gets()
- Scanf()
- 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:
- %
- *
- 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.
- Built in
- Local.
- User defined
- 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?
- One
- Two
- Ten
- 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:
- Unsigned decimal Integer
- Unsigned float
- Unsigned short
- 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
- Character
- Integer
- Double
- 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:
- Character
- Integers
- Float
- 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?
- %d
- %ec
- %s
- %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:
- /a
- /n
- \b
- /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);
- infinite 1
- 1
- 2
- 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:
- New line
- Backstash
- Space
- 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:
- m.n%
- m.nf
- m.n%
- m%.nf
Answer: m.n%
Explanation: m.n%
Q26) The escape sequence for carriage return is:
- \a
- \c
- \t
- \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?
- \a
- \z
- \n
- \r
Answer:\z
Explanation:\z
Q28) The & symbol in scaf function indicate variable’s i
- Value
- Access
- Address
- 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.
- integer variable
- String variable
- Character variable
- Float variable
Answer:Character variable
Explanation:Character variable
Q30) getch () stands for: (C) (D)
- get character
- Give character
- go Character
- 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".
0 Comments