Menu

Objective Type Questions & Answers


PPS MCQs - Unit-1



1. Which of the following is a primary role of a compiler?

A . Execute code

B . Translate source code into machine code

C . Debug programs

D . Store data

Answer



2. In C programming, what is the data type that can store decimal numbers?

A . int

B . char

C . float

D . bool

Answer



3. What type of error occurs when the syntax of the code is incorrect?

A . Logical error

B . Runtime error

C . Syntax error

D . Compilation error

Answer



4. Which of the following storage classes in C has a scope limited to the block in which it is defined?

A . extern

B . static

C . register

D . auto

Answer



5. What does the `printf` function primarily do?

A . Reads user input

B . Outputs formatted data to the console

C . Compiles code

D . Stores data

Answer



6. Which operator is used for bitwise AND operation in C?

A . &&

B . &

C . ||

D . |

Answer



7. In a switch-case statement, what is the purpose of the `default` case?

A . To handle all cases

B . To terminate the program

C . To handle unspecified cases

D . To execute the first case

Answer



8. Which loop in C will always execute at least once?

A . for loop

B . while loop

C . do-while loop

D . none of the above

Answer



9. What is the correct way to declare an integer variable in C?

A . int 1number;

B . int number;

C . number int;

D . int number[];

Answer



10. Which of the following is not a valid C data type?

A . int

B . float

C . string

D . char

Answer



11. What does the `goto` statement do in C?

A . Jump to a specific line of code

B . End the program

C . Loop through an array

D . Conditional branching

Answer



12. Which command line argument is typically used to pass input to a C program?

A . -input

B . argv

C . argc

D . input

Answer



13. In C, what will be the output of printf("%d", 5 + 3 * 2);

A . 16

B . 11

C . 8

D . 10

Answer



14. Which of the following correctly describes a prime number?

A . A number that has more than two factors

B . A number that can be divided only by 1 and itself

C . A negative number

D . Any integer greater than 0

Answer



15. What is the output of the following code snippet? printf("%c", `A` + 1);

A . A

B . B

C . C

D . 66

Answer



16. In a flowchart, what does the diamond shape represent?

A . Start/End

B . Process

C . Input/Output

D . Decision

Answer



17. Which operator is used for bitwise OR operation in C?

A . &

B . |

C . ^

D . ~

Answer



18. What type of loop would you use when the number of iterations is not known beforehand?

A . for loop

B . while loop

C . do-while loop

D . foreach loop

Answer



19. What is the purpose of `extern` storage class?

A . To define a variable in the local scope

B . To make a variable available across multiple files

C . To create a static variable

D . To allocate dynamic memory

Answer



20. Which of the following is a correct declaration of a float variable in C?

A . float number = 5.5;

B . float number(5.5);

C . float number : 5.5;

D . float number[5.5];

Answer



21. In C, how do you indicate a comment that spans multiple lines?

A . // comment

B . /* comment */

C . # comment

D . ** comment **

Answer



22. What does the `sizeof` operator do in C?

A . Returns the size of a variable in bits

B . Returns the size of a variable in bytes

C . Allocates memory

D . Converts data types

Answer



23. Which of the following is an example of a logical error?

A . Missing semicolon

B . Infinite loop

C . Incorrect output despite correct syntax

D . Using undeclared variable

Answer



24. What is the result of the expression 5 & 3 in C?

A . 8

B . 2

C . 0

D . 1

Answer



25. Which of the following is an example of explicit type casting in C?

A . int x = 5.6;

B . float y = (float)7;

C . char z = `A` + 32;

D . double w = 3 / 2;

Answer



26. A user wants to calculate the area of a rectangle with a length of 5 and a width of 10. Which algorithm would best describe the solution?

A . Area = Length + Width

B . Area = Length × Width

C . Area = Length / Width

D . Area = Length - Width

Answer



27. You are designing an app to determine if a user’s age qualifies for a senior citizen discount. What conditional statement would you use?

A . if age > 60

B . if age < 60

C . if age == 60

D . if age >= 60

Answer



28. A program needs to find the maximum score from a list of exam scores. Which storage class would be best for the maximum score variable within the function?

A . static

B . extern

C . auto

D . register

Answer



29. You want to print a message in a C program indicating successful completion of a task. Which output function would you use?

A . printf("Task completed successfully.");

B . scanf("Task completed successfully.");

C . input("Task completed successfully.");

D . output("Task completed successfully.");

Answer



30. When compiling a program, what is generated that the operating system can execute directly?

A . Source code

B . Pseudocode

C . Object code

D . Flowchart

Answer



31. A grocery store wants to calculate discounts for products. If the original price is $50 and the discount is 20%, what should be the new price calculated using C?

A . New Price = 50 - (50 * 0.2)

B . New Price = 50 + (50 * 0.2)

C . New Price = 50 / 0.2

D . New Price = 50 * 0.2

Answer



32. If you want to iterate through a list of customer names using a loop, which loop structure would be most appropriate if you know the number of names?

A . while loop

B . for loop

C . do-while loop

D . goto loop

Answer



33. Which loop in C is used when you want the loop to execute at least once?

A . for loop

B . while loop

C . do-while loop

D . if-else loop

Answer



34. A program needs to read a user`s input for their favorite fruit. Which function would you use?

A . output()

B . printf()

C . scanf()

D . read()

Answer



35. To track a global variable used across multiple files in a project, which storage class should you choose?

A . static

B . auto

C . extern

D . register

Answer



36. If you want to store a list of ages, which data type would be most appropriate in C?

A . float

B . char

C . int

D . double

Answer



37. Which bitwise operation would you use to toggle a specific bit in a number?

A . AND

B . OR

C . XOR

D . NOT

Answer



38. To find the minimum number in a list of temperatures, which pseudocode step is essential?

A . Initialize a variable to store the maximum temperature.

B . Compare each temperature with the current minimum.

C . Calculate the average temperature.

D . Sort the list of temperatures.

Answer



39. Which type of error occurs when the program runs but produces incorrect results?

A . Compilation error

B . Syntax error

C . Runtime error

D . Logical error

Answer



40. In a program to determine eligibility for voting, which conditional structure would you use to check if a person is over 18 years old?

A . switch-case

B . if-else

C . for loop

D . do-while

Answer



41. A function needs to output a formatted date, such as "Today is: 2024-10-16". Which C function is best for this?

A . scanf()

B . print()

C . printf()

D . output()

Answer



42. You are writing a program to find out how many times a user can afford a $10 movie ticket with $100. Which operator would you use?

A . +

B . -

C . /

D . *

Answer



43. To create a simple menu for user choices, which structure would be most appropriate?

A . if-else

B . switch-case

C . for loop

D . while loop

Answer



44. Which statement correctly identifies the output of printf("%d", 10 >> 1);?

A . 5

B . 10

C . 20

D . 0

Answer



45. When reading a floating-point number from user input, which format specifier should you use in scanf?

A . %d

B . %f

C . %c

D . %s

Answer



46. In a project that requires a calculation for the area of a triangle, what formula would you represent in pseudocode?

A . Area = base + height

B . Area = 0.5 * base * height

C . Area = base / height

D . Area = base - height

Answer



47. Which logical operator would you use to check if a number is both even and greater than zero?

A . OR

B . AND

C . NOT

D . XOR

Answer



Fill in the Blanks


48. A ______________ is a software tool that translates high-level programming code into machine code or an intermediate code.

Answer


49. After compilation, the result is typically an ______________ file, which can be executed directly by the computer.

Answer


50. The first step in program execution is the ______________ phase, where the operating system loads the program into memory.

Answer


51. A ______________ is a step-by-step set of instructions for solving a specific problem.

Answer


52. Flowcharts are a graphical way to represent algorithms using ______________ and ______________.

Answer


53. In a flowchart, a rectangle is used to represent a ______________.

Answer


54. ______is a programming paradigm that promotes the use of functions or procedures to break a program into smaller, manageable parts.

Answer


55. A variable`s ____________ defines the type of data it can hold.

Answer


56. The size of the char data type in C is ____________ bytes.

Answer


57. A ____________ error occurs when the code violates the rules of the programming language.

Answer


58. Logical errors can lead to incorrect program ____________.

Answer


59. In the expression 5 + 3 * 2, the multiplication operator * has higher ____________ than the addition operator +.

Answer


60. In C, the result of integer division, such as 7 / 3, is ____________.

Answer


61. The ____________ storage class specifies that a variable`s value is retained between function calls.

Answer


62. The ____________ storage class is used to declare global variables.

Answer


63. Explicit type conversion is also known as ____________.

Answer




Relevant Materials :

PPS MCQs - Unit-1 - [ PPS ]

PPS MCQs - Unit-2 - [ PPS ]

PPS MCQs - Unit-3 - [ PPS ]

PPS MCQs - Unit-4 - [ PPS ]

PPS MCQs - Unit-5 - [ PPS ]


Similar Materials :

R - Programming MCQs - Unit-1 - [ R-Programming ]

R - Programming MCQs - Unit-2 - [ R-Programming ]

R - Programming MCQs - Unit-3 - [ R-Programming ]

R - Programming MCQs - Unit-4 - [ R-Programming ]

R - Programming MCQs - Unit-5 - [ R-Programming ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-1 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-2 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-3 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-4 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-5 - [ FLAT ]

Object Oriented Programming through Java MCQs - Unit-1 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-2 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-3 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-4 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-5 - [ OOP_JAVA ]

Design and Analysis of Algorithms MCQs - Unit-1 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-2 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-3 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-4 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-5 - [ DAA ]

Software Engineering MCQs - Unit-1 - [ SE ]

Software Engineering MCQs - Unit-2 - [ SE ]

Software Engineering MCQs - Unit-3 - [ SE ]

Software Engineering MCQs - Unit-4 - [ SE ]

Software Engineering MCQs - Unit-5 - [ SE ]

Data Mining MCQs - Unit-1 - [ DM ]

Data Mining MCQs - Unit-2 - [ DM ]

Data Mining MCQs - Unit-3 - [ DM ]

Data Mining MCQs - Unit-4 - [ DM ]

Data Mining MCQs - Unit-5 - [ DM ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-1 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-2 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-3 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-4 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-5 - [ COA ]

Data Structures Objective Type Question Bank-Unit-1 - [ DS ]

Data Structures Objective Type Question Bank-Unit-2 - [ DS ]

Data Structures Objective Type Question Bank-Unit-3 - [ DS ]

Data Structures Objective Type Question Bank-Unit-4 - [ DS ]

Data Structures Objective Type Question Bank-Unit-5 - [ DS ]

Database Management System Objective Type Question Bank-Unit-1 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-2 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-3 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-4 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-5 - [ DBMS ]

Cyber Forensics Objective Type Question Bank-Part-2 - [ Cyber Forensics ]

Cyber Forensics Objective Type Question Bank-Part-1 - [ Cyber Forensics ]

Java Programming Objective Type Question Bank - [ Java Programming ]

Java Programming Objective Type Questions-Part-1 - [ Java Programming ]

Java Programming Objective Type Questions-Part-2 - [ Java Programming ]