PPS I Mid Important Objective Questions (PDF)

Document Details

AppropriateHexagon9255

Uploaded by AppropriateHexagon9255

Tags

programming C language objective questions computer science

Summary

This document contains a past paper of multiple-choice questions on the C programming language. It covers topics such as keywords, arrays, operators, and functions,  including pseudocode examples and conceptual questions.

Full Transcript

**PPS I MID IMPORTANT OBJECTIVE QUESTIONS** **Multiple Choice Questions:** 1.How many keywords are there in C Language? a.32 b.35 c.44 d.31 Ans: A 2\. main() { int a=6; printf(\"%d\",(a++)); } a\. The value of (a + 1) b. The current value of a c\. Error message d. Garbage Value Ans: B...

**PPS I MID IMPORTANT OBJECTIVE QUESTIONS** **Multiple Choice Questions:** 1.How many keywords are there in C Language? a.32 b.35 c.44 d.31 Ans: A 2\. main() { int a=6; printf(\"%d\",(a++)); } a\. The value of (a + 1) b. The current value of a c\. Error message d. Garbage Value Ans: B 3.READ number PRINT \"The number is \", number\ What does this pseudocode do? A. Reads and prints a number B. Prints a fixed number C. Generates a random number D. None of these Ans: A 4.What is the main function of a compiler in programming? a\. To write code b. To interpret code c.To convert code into machine language d. To debug code Ans: C 5.Pseudocode int main() {\ printf(\"%d\", 500);\ return 0;\ } A.500 B.%d C.Syntax Error D. None of these Ans:A 6.How do you declare an array of integers in C? a.int arr\[10\]; b. array int\[10\]; c\. int array 10; d. \[10\]int array; Ans: A 7\. Which of the following is not a keyword in C? a.int b. char c.include d.float Ans: C 8.SET a TO 10, b TO 20 PRINT a PLUS b A.30 B. 20 C.10 D.0 Ans:A 9.Which of the following is a valid variable in C? a.2ndName b. \_name c\. \#name d.none of these Ans: B 10\. Which operator has higher precedence, \'+\' or \'\*\'? a.\* b.Both are same c.+= d.+ Ans: A 11\. What is the purpose of the printf function in C? a\. To read input b. To print output c.To perform calculations d. To control program flow Ans: B 12.What is the result of the logical expression (1 && 0)? a.1 b.0 c.True d.False Ans: B 13\. What is the size of a 2-dimensional array int arr\[3\]\[4\] in C? a.3 b.4 c\. 12 d. 24 Ans: C 14\. What is the output of the following C code snippet?\ int main() {\ int x= 10;\ printf(\"%d\", x++ + ++x);\ return 0;\ } A.20 B. 21 C.22 D. 23 Ans:C 15\. What does the break statement do in a loop? A.Exits the loop B.Skips the current iteration C.Repeats the loop D.Does nothing Ans:A 16.In a switch statement, what happens if a break statement is omitted from a case? A.The program exits B.The case is skipped C.Fall-through to the next case D.Syntax error Ans:C 17.Find the mistake in this code:\ int main() {\ float num;\ printf(\"Enter a number: \");\ scanf(\"%f\", num);\ printf(\"You entered: %f\", num);\ return 0;\ } A.Missing & in scanf B. Incorrect format specifier in printf C.No error D. Syntax error Ans:A 18.What does %d signify in the printf or scanf function? A.Double data type B. Decimal integer C.Dynamic allocation D. Directory path Ans:B 19.Which operator has higher precedence, \'+\' or \'\*\'? A.\* B. Both are same C=+ D.None Ans:A 20\. Pseudocode int main() {\ int number = 100.5;\ printf(\"%d\", number);\ return 0;\ } a\. Assigning float to int b. Syntax error c\. No error d. Wrong printf format Ans: A 21\. Who is the father of C language?\ a) Steve Jobs b) James Gosling\ c) Dennis Ritchie d) Rasmus Lerdorf Ans: C ### 22. C language is a \_\_\_. A. Procedural oriented programming language B. General purpose programming language C. Structured programming D. All of the above Ans: D 23.What is the extension of a C language source file? A..c B..cpp C..c99 D..h Ans:A ### 24. How many byte(s) does a char type take in C? A. 1 B. 2 C. 3 D. 4 Ans:A **25.Spot the error:**\ int main() {\ int a = 10, b = 0;\ printf(\"%d\", a / b);\ return 0;\ } A.Division by zero B.Syntax error C.No error D.Wrong format specifier Ans:A **Fill in the blanks:** 1.What does the break statement do in a loop **\_comes out of the loop** 2.In a switch statement, what happens if a break statement is omitted from a case? **continue to execute the next statement\_\_**\_ 3.What is the purpose of the continue statement in loops\_**Skips the lines of code** 4.\_**String**\_is the collection of Arrays of Characters 5.Full Form of ASCII\_**American Standard Code for Information Interchange** 6.The**\_int\_\_**is the default return type for main 7.The **Program**\_is the set of instruction 8.Error is also called as\_**bug\_\_** 9.Declare a two dimensional array with its initialization **int a\[2\]\[2\]={23,24,43,11};** 10.Define Constant: **It doesnot changes through out the execution of the Program** 11\. A **Newline(\\n)** character instructs the computer to move the control to the next line newline 12\. C language was implemented at the **AT &T Bell** laboratories. 13\. C program execution begins from\-\--**main() function** 14.Each string is terminated with a **Null pointer ("\\0")** character. 15.The function is used to concatenate one string to the end of another string\_**strcat()\_** 16.An array is a collection of data elements of the same \_\_**Datatype under one name.** 17.The **\_Index or Size\_**value is used to access the data element of an array 18\. Conditional operator is also called\_\_\_**ternary**\_operator as it operates on three operands. 19\. In switch statement, each case must be terminated by a **break** statement. 20\. While statement executes its body only if the condition is**\_\_True\_** 21**. \_\_%s\_\_**format specifier can be used to read/print a string 22\. In C language, an array starting address is called as **Base Address** 23.What is the use of strstr function in strings\_**to find the substring in main string** 24\. The Processing of removing the Errors from Program is called\_**Debugging** 25.write an example for syntax error\_**Semicolon missing(;)** ###

Use Quizgecko on...
Browser
Browser