Which of the following is an example of explicit type casting in C?
Aint x = 5.6;
Bfloat y = (float)7;
Cchar z = 'A' + 32;
Ddouble w = 3 / 2;
Correct Answerfloat y = (float)7;
30
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?
AArea = Length + Width
BArea = Length Γ Width
CArea = Length / Width
DArea = Length - Width
Correct AnswerArea = Length Γ Width
31
You are designing an app to determine if a userβs age qualifies for a senior citizen discount. What conditional statement would you use?
Aif age > 60
Bif age < 60
Cif age == 60
Dif age >= 60
Correct Answerif age >= 60
32
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?
Astatic
Bextern
Cauto
Dregister
Correct Answerauto
33
You want to print a message in a C program indicating successful completion of a task. Which output function would you use?
When compiling a program, what is generated that the operating system can execute directly?
ASource code
BPseudocode
CObject code
DFlowchart
Correct AnswerObject code
35
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?
ANew Price = 50 - (50 * 0.2)
BNew Price = 50 + (50 * 0.2)
CNew Price = 50 / 0.2
DNew Price = 50 * 0.2
Correct AnswerNew Price = 50 - (50 * 0.2)
36
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?
Awhile loop
Bfor loop
Cdo-while loop
Dgoto loop
Correct Answerfor loop
37
Which loop in C is used when you want the loop to execute at least once?
Afor loop
Bwhile loop
Cdo-while loop
Dif-else loop
Correct Answerdo-while loop
38
A program needs to read a user's input for their favorite fruit. Which function would you use?
Aoutput()
Bprintf()
Cscanf()
Dread()
Correct Answerscanf()
39
To track a global variable used across multiple files in a project, which storage class should you choose?
Astatic
Bauto
Cextern
Dregister
Correct Answerextern
40
If you want to store a list of ages, which data type would be most appropriate in C?
Afloat
Bchar
Cint
Ddouble
Correct Answerint
41
Which bitwise operation would you use to toggle a specific bit in a number?
AAND
BOR
CXOR
DNOT
Correct AnswerXOR
42
To find the minimum number in a list of temperatures, which pseudocode step is essential?
AInitialize a variable to store the maximum temperature.
BCompare each temperature with the current minimum.
CCalculate the average temperature.
DSort the list of temperatures.
Correct AnswerCompare each temperature with the current minimum.
43
Which type of error occurs when the program runs but produces incorrect results?
ACompilation error
BSyntax error
CRuntime error
DLogical error
Correct AnswerLogical error
44
In a program to determine eligibility for voting, which conditional structure would you use to check if a person is over 18 years old?
Aswitch-case
Bif-else
Cfor loop
Ddo-while
Correct Answerif-else
45
A function needs to output a formatted date, such as "Today is: 2024-10-16". Which C function is best for this?
Ascanf()
Bprint()
Cprintf()
Doutput()
Correct Answerprintf()
46
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*
Correct Answer/
47
To create a simple menu for user choices, which structure would be most appropriate?
Aif-else
Bswitch-case
Cfor loop
Dwhile loop
Correct Answerswitch-case
48
Which statement correctly identifies the output of printf("%d", 10 >> 1);?
A5
B10
C20
D0
Correct Answer5
49
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
Correct Answer%f
50
In a project that requires a calculation for the area of a triangle, what formula would you represent in pseudocode?
AArea = base + height
BArea = 0.5 * base * height
CArea = base / height
DArea = base - height
Correct AnswerArea = 0.5 * base * height
51
Which logical operator would you use to check if a number is both even and greater than zero?
AOR
BAND
CNOT
DXOR
Correct AnswerAND
Fill in the Blanks
52A ______________ is a software tool that translates high-level programming code into machine code or an intermediate code.
Correct AnswerCompiler
53After compilation, the result is typically an ______________ file, which can be executed directly by the computer.
Correct AnswerExecutable
54The first step in program execution is the ______________ phase, where the operating system loads the program into memory.
Correct AnswerLoading
55A ______________ is a step-by-step set of instructions for solving a specific problem.
Correct AnswerAlgorithm
56Flowcharts are a graphical way to represent algorithms using ______________ and ______________.
Correct AnswerSymbols, arrows
57In a flowchart, a rectangle is used to represent a ______________.
Correct AnswerProcess
58______is a programming paradigm that promotes the use of functions or procedures to break a program into smaller, manageable parts.
Correct AnswerStructured Programming
59A variable's ____________ defines the type of data it can hold.
Correct Answerdata type
60The size of the char data type in C is ____________ bytes.
Correct Answer1
61A ____________ error occurs when the code violates the rules of the programming language.
Correct Answersyntax
62Logical errors can lead to incorrect program ____________.
Correct Answerbehavior
63In the expression 5 + 3 * 2, the multiplication operator * has higher ____________ than the addition operator +.
Correct Answerprecedence
64In C, the result of integer division, such as 7 / 3, is ____________.
Correct Answer2
65The ____________ storage class specifies that a variable's value is retained between function calls.
Correct Answerstatic
66The ____________ storage class is used to declare global variables.
Correct Answerextern
67Explicit type conversion is also known as ____________.