Programming Fundamentals – 300 MCQs
Show All Answers
Hide All Answers
Problem Solving, Logic and Computing Basics Programming, Translation Tools and Program Structure Data Types, Variables and Input/Output Operators and Expressions Conditional Statements and Execution Flow Repetition, Loops and Iterative Logic Lists, Arrays and Multidimensional Lists Functions, Modular Programming and Program Stack Strings and String Operations Pointers, References and Static Memory Concepts Dynamic Memory Allocation and File I/O Mixed Concepts, Tracing and Real-World Algorithm Design
A Write code immediately
B Understand and define the problem clearly
C Compile the program
D Run test cases
Show Answer
Correct Answer:
B) Understand and define the problem clearly
A A programming language
B A step-by-step procedure to solve a problem
C A computer device
D A type of memory
Show Answer
Correct Answer:
B) A step-by-step procedure to solve a problem
A Store data permanently
B Represent the logic of a solution visually
C Translate code to machine language
D Measure program speed
Show Answer
Correct Answer:
B) Represent the logic of a solution visually
A Replacing hardware
B Expressing solution steps in simple structured language
C Removing all bugs automatically
D Creating executable files
Show Answer
Correct Answer:
B) Expressing solution steps in simple structured language
A Deleting extra code
B Breaking a large problem into smaller parts
C Combining all files
D Reducing RAM usage
Show Answer
Correct Answer:
B) Breaking a large problem into smaller parts
A Input, Process, Output
B Initialize, Program, Operate
C Input, Print, Operate
D Inspect, Process, Organize
Show Answer
Correct Answer:
A) Input, Process, Output
A Input/output
B Start/end
C A condition or branching point
D A connector
Show Answer
Correct Answer:
C) A condition or branching point
A A process or instruction
B A loop only
C A decision
D An output device
Show Answer
Correct Answer:
A) A process or instruction
A Arithmetic operations
B Start and end
C Variable declaration
D Comments
Show Answer
Correct Answer:
B) Start and end
A Install the compiler
B Follow step execution using sample values
C Create machine code
D Increase processor speed
Show Answer
Correct Answer:
B) Follow step execution using sample values
A Programs and data are stored in memory
B The CPU is optional
C Only output matters
D Each device has its own language
Show Answer
Correct Answer:
A) Programs and data are stored in memory
A Scanner
B Arithmetic Logic Unit
C Monitor
D Printer
Show Answer
Correct Answer:
B) Arithmetic Logic Unit
A Displaying graphics
B Directing and coordinating operations
C Storing files forever
D Typing source code
Show Answer
Correct Answer:
B) Directing and coordinating operations
A Store currently running programs and data
B Print reports
C Send emails
D Scan documents
Show Answer
Correct Answer:
A) Store currently running programs and data
A Show results
B Enter data into the computer
C Store backups offline
D Cool the processor
Show Answer
Correct Answer:
B) Enter data into the computer
A Receive user data only
B Display processed results
C Translate all programs
D Control loops
Show Answer
Correct Answer:
B) Display processed results
A Is close to human language and easier to understand
B Runs only on high floors
C Needs no translator
D Is part of hardware
Show Answer
Correct Answer:
A) Is close to human language and easier to understand
A English commands
B Binary instructions understood directly by the computer
C Flowchart symbols
D Mathematical formulas only
Show Answer
Correct Answer:
B) Binary instructions understood directly by the computer
A The translated machine code
B The program written by a programmer
C The output of the linker
D The printed document
Show Answer
Correct Answer:
B) The program written by a programmer
A Logic is incorrect though code runs
B The rules of the language are violated
C Input is too large
D A file is saved
Show Answer
Correct Answer:
B) The rules of the language are violated
A The compiler crashes
B The program runs but produces wrong results
C The keyboard is disconnected
D The program cannot be loaded
Show Answer
Correct Answer:
B) The program runs but produces wrong results
A Removes the need for coding
B Helps verify logic before or during implementation
C Adds memory automatically
D Converts source to object code
Show Answer
Correct Answer:
B) Helps verify logic before or during implementation
A Printers
B Algorithms
C Keyboards
D Databases
Show Answer
Correct Answer:
B) Algorithms
A Ambiguous and lengthy
B Clear, correct, and efficient
C Dependent on one machine only
D Impossible to test
Show Answer
Correct Answer:
B) Clear, correct, and efficient
A Ignoring everything always
B Focusing on important details while hiding unnecessary complexity
C Writing very long code
D Avoiding variables
Show Answer
Correct Answer:
B) Focusing on important details while hiding unnecessary complexity
A Create hardware circuits
B Translate source code into machine/object code
C Display flowcharts
D Store files permanently
Show Answer
Correct Answer:
B) Translate source code into machine/object code
A Take user input
B Combine object files and libraries into an executable program
C Edit source code
D Compress images
Show Answer
Correct Answer:
B) Combine object files and libraries into an executable program
A Executes code line by line
B Needs no source code
C Works only for assembly
D Produces hardware output
Show Answer
Correct Answer:
A) Executes code line by line
A A flowchart drawing
B The low-level translated form of source code
C Always human-readable pseudocode
D A backup copy of RAM
Show Answer
Correct Answer:
B) The low-level translated form of source code
A Only pictures
B Reusable prewritten code or functions
C Damaged files
D CPU registers
Show Answer
Correct Answer:
B) Reusable prewritten code or functions
A Compilation
B Execution
C Printing
D File saving
Show Answer
Correct Answer:
A) Compilation
A Can be directly run by the operating system
B Contains only comments
C Must always be interpreted manually
D Stores only images
Show Answer
Correct Answer:
A) Can be directly run by the operating system
A A hardware chip
B A meaningful unit such as keyword, identifier, or operator
C An output device
D A debugging tool
Show Answer
Correct Answer:
B) A meaningful unit such as keyword, identifier, or operator
A Words programmers may freely rename
B Keywords with special predefined meaning
C Comments added by users
D Variable values
Show Answer
Correct Answer:
B) Keywords with special predefined meaning
A Speed up execution greatly
B Improve readability and documentation
C Replace variables
D Generate machine code
Show Answer
Correct Answer:
B) Improve readability and documentation
A A random memory cell
B A complete instruction for the computer
C Always a function call
D Only an arithmetic expression
Show Answer
Correct Answer:
B) A complete instruction for the computer
A Uncontrolled jumps everywhere
B Clear sequence, selection, and repetition
C Removing all functions
D Using only one variable
Show Answer
Correct Answer:
B) Clear sequence, selection, and repetition
A Starting from detailed code first
B Breaking the solution from general steps into smaller modules
C Writing from bottom of screen
D Compiling before analysis
Show Answer
Correct Answer:
B) Breaking the solution from general steps into smaller modules
A Damage program logic
B Improve readability and sometimes define blocks
C Replace semicolons in all languages
D Create variables
Show Answer
Correct Answer:
B) Improve readability and sometimes define blocks
A Meaning or valid use of constructs
B Printer failure
C Electric power loss
D Font selection
Show Answer
Correct Answer:
A) Meaning or valid use of constructs
A Problem analysis
B Algorithm design
C Testing and debugging
D Ignoring outputs
Show Answer
Correct Answer:
D) Ignoring outputs
A Creating new hardware
B Finding and fixing errors in a program
C Translating source to assembly only
D Making variables constant
Show Answer
Correct Answer:
B) Finding and fixing errors in a program
A Recycling memory
B Linking modules
C Typing faster
D Changing monitor settings
Show Answer
Correct Answer:
B) Linking modules
A Makes maintenance and testing easier
B Forces one giant function
C Prevents reuse
D Removes logic from programs
Show Answer
Correct Answer:
A) Makes maintenance and testing easier
A It can run on different systems with little or no change
B It fits in a small folder
C It avoids input
D It needs no compiler
Show Answer
Correct Answer:
A) It can run on different systems with little or no change
A More confusing code
B Better readability and maintainability
C Faster internet
D Automatic bug removal
Show Answer
Correct Answer:
B) Better readability and maintainability
A A loop body
B A main function or starting routine
C A comment block
D A string literal
Show Answer
Correct Answer:
B) A main function or starting routine
A Before successful program execution
B After printing output
C Only on Friday
D By changing hardware
Show Answer
Correct Answer:
A) Before successful program execution
A Only electricity
B Editing, building, and debugging tools in one environment
C A new programming language
D Permanent data storage
Show Answer
Correct Answer:
B) Editing, building, and debugging tools in one environment
A The code is perfect
B There may be a potential issue even if compilation succeeds
C The program has been deleted
D RAM is full
Show Answer
Correct Answer:
B) There may be a potential issue even if compilation succeeds
A A fixed value that never changes
B A named memory location used to store data
C A type of compiler
D An output statement
Show Answer
Correct Answer:
B) A named memory location used to store data
A To delete memory
B Its name and data type
C To run the program
D To print the value
Show Answer
Correct Answer:
B) Its name and data type
A Whole numbers
B Text sentences
C True/false only
D Decimal fractions only
Show Answer
Correct Answer:
A) Whole numbers
A Character storage
B Numbers with fractional parts
C File names
D Boolean conditions
Show Answer
Correct Answer:
B) Numbers with fractional parts
A A single symbol such as 'A'
B A full paragraph
C A floating value
D Multiple arrays
Show Answer
Correct Answer:
A) A single symbol such as 'A'
A Letters only
B True/false values
C Decimal numbers only
D File handles
Show Answer
Correct Answer:
B) True/false values
A Removing a variable
B Giving a variable its first value
C Converting code to binary
D Reading a file
Show Answer
Correct Answer:
B) Giving a variable its first value
A A value that does not change during program execution
B A changing variable
C A temporary bug
D A loop counter only
Show Answer
Correct Answer:
A) A value that does not change during program execution
A Start with any punctuation mark
B Be meaningful and follow language rules
C Contain spaces always
D Match the answer key
Show Answer
Correct Answer:
B) Be meaningful and follow language rules
A Guaranteed correct output
B Unpredictable results
C Automatic optimization
D Permanent storage
Show Answer
Correct Answer:
B) Unpredictable results
A Add comments
B Convert one data type to another
C Create a loop
D Read a file
Show Answer
Correct Answer:
B) Convert one data type to another
A Make code shorter only
B Provide data during program execution
C Translate the compiler
D Build libraries
Show Answer
Correct Answer:
B) Provide data during program execution
A Display information to the user
B Declare variables
C Create processors
D Define algorithms
Show Answer
Correct Answer:
A) Display information to the user
A Confuses the user
B Tells the user what input is expected
C Deletes previous input
D Stops execution
Show Answer
Correct Answer:
B) Tells the user what input is expected
A A monitor
B A variable
C A printer
D A compiler
Show Answer
Correct Answer:
B) A variable
A Always holds numbers only
B Contains a sequence of characters
C Uses less memory than one char
D Cannot be displayed
Show Answer
Correct Answer:
B) Contains a sequence of characters
A totalMarks
B _count
C 2value
D student_name
Show Answer
Correct Answer:
C) 2value
A Only screen color
B The kind of values a variable can hold and related operations
C Internet speed
D Whether code has comments
Show Answer
Correct Answer:
B) The kind of values a variable can hold and related operations
A No variables
B Separate variables or data structures
C A printer driver
D A linker option
Show Answer
Correct Answer:
B) Separate variables or data structures
A Organizing displayed values neatly
B Compiling faster
C Removing syntax errors
D Changing the CPU
Show Answer
Correct Answer:
A) Organizing displayed values neatly
A A value written directly in the program
B A memory leak
C An external device
D A loop block
Show Answer
Correct Answer:
A) A value written directly in the program
A 98
B 3.14
C "Hello"
D false
Show Answer
Correct Answer:
C) "Hello"
A Into a variable
B Into the compiler
C Into the keyboard
D Into a flowchart
Show Answer
Correct Answer:
A) Into a variable
A x becomes zero
B x is increased by one
C x is compared with one
D x is printed
Show Answer
Correct Answer:
B) x is increased by one
A Accept every value blindly
B Check whether entered data is reasonable and correct
C Convert source to object code
D Avoid all variables
Show Answer
Correct Answer:
B) Check whether entered data is reasonable and correct
A Make decisions only
B Perform mathematical calculations
C Read files
D Create comments
Show Answer
Correct Answer:
B) Perform mathematical calculations
Show Answer
Correct Answer:
B) %
Show Answer
Correct Answer:
A) 2
A Store files
B Compare two values
C Create loops only
D Compile code
Show Answer
Correct Answer:
B) Compare two values
Show Answer
Correct Answer:
B) true
A At least one condition is true
B Both conditions are true
C Both conditions are false
D Only the first is true
Show Answer
Correct Answer:
B) Both conditions are true
A Both conditions are false
B At least one condition is true
C Both conditions are true
D Only one is true
Show Answer
Correct Answer:
A) Both conditions are false
A Add numbers
B Reverse a Boolean value
C Store strings
D Multiply values
Show Answer
Correct Answer:
B) Reverse a Boolean value
A Where output appears
B Which operator is evaluated first
C How files are opened
D How many variables exist
Show Answer
Correct Answer:
B) Which operator is evaluated first
A Always slow programs
B Make intended evaluation order clear
C Remove variables
D Replace assignment
Show Answer
Correct Answer:
B) Make intended evaluation order clear
A Compares two values
B Stores the right-hand value in the left-hand variable
C Ends a loop
D Starts a function
Show Answer
Correct Answer:
B) Stores the right-hand value in the left-hand variable
Show Answer
Correct Answer:
B) <=
A false
B true
C 5
D an error always
Show Answer
Correct Answer:
B) true
A age > 18 || age < 60
B age >= 18 && age <= 60
C age = 18 to 60
D 18 <= age or 60
Show Answer
Correct Answer:
B) age >= 18 && age <= 60
A The quotient
B The remainder or fractional part
C The dividend
D The operator
Show Answer
Correct Answer:
B) The remainder or fractional part
A Only comments
B The operand types and operators used
C Monitor size
D File name
Show Answer
Correct Answer:
B) The operand types and operators used
A Reducing it by one
B Increasing it by one
C Making it constant
D Converting it to text
Show Answer
Correct Answer:
B) Increasing it by one
A x = x + 3
B x == 3
C x = 3 only
D x is Boolean
Show Answer
Correct Answer:
A) x = x + 3
A Evaluate all operands always
B Stop evaluation once the result is known
C Delete the second condition
D Print the answer
Show Answer
Correct Answer:
B) Stop evaluation once the result is known
A Using comments
B Storing a very large value in a small integer type
C Declaring a string
D Reading a small number
Show Answer
Correct Answer:
B) Storing a very large value in a small integer type
A A named memory block only
B A combination of values, variables, and operators that produces a result
C A hardware device
D A complete flowchart
Show Answer
Correct Answer:
B) A combination of values, variables, and operators that produces a result
A x is positive
B x is not greater than zero
C x becomes zero
D x is printed
Show Answer
Correct Answer:
B) x is not greater than zero
Show Answer
Correct Answer:
B) *
A Decimals cannot exist
B Representation can introduce precision issues
C Compilers forbid it
D Booleans change it
Show Answer
Correct Answer:
B) Representation can introduce precision issues
A The smaller of a and b
B The larger value if a>b else b
C A Boolean only
D Nothing
Show Answer
Correct Answer:
B) The larger value if a>b else b
A Store files
B Make decisions in a program
C Create arrays only
D Translate source code
Show Answer
Correct Answer:
B) Make decisions in a program
A if statement
B for loop
C array
D function parameter
Show Answer
Correct Answer:
A) if statement
A false
B true
C empty
D negative only
Show Answer
Correct Answer:
B) true
A Repeat the condition
B Provide an alternate block when condition is false
C End the program
D Create a variable
Show Answer
Correct Answer:
B) Provide an alternate block when condition is false
A Only one condition exists
B Multiple conditions must be tested in sequence
C No condition is required
D Using strings only
Show Answer
Correct Answer:
B) Multiple conditions must be tested in sequence
A if statements placed inside another if or else block
B Always invalid
C Used only in hardware
D The same as comments
Show Answer
Correct Answer:
A) if statements placed inside another if or else block
A Complex floating arithmetic only
B Selecting among many discrete cases of one expression
C Allocating memory
D Reading files
Show Answer
Correct Answer:
B) Selecting among many discrete cases of one expression
A The first case matches
B No listed case matches
C Every case matches
D The loop ends
Show Answer
Correct Answer:
B) No listed case matches
A A string
B A Boolean result
C A file pointer
D An array
Show Answer
Correct Answer:
B) A Boolean result
A Selection
B Recursion
C Linking
D Compilation
Show Answer
Correct Answer:
A) Selection
A Removing indentation
B Using clear block structure and braces
C Using more comments only
D Avoiding all if statements
Show Answer
Correct Answer:
B) Using clear block structure and braces
A Must always be nested
B Can all be tested separately
C Never execute
D Become loops
Show Answer
Correct Answer:
B) Can all be tested separately
A Handle exceptional or invalid cases early
B Increase RAM
C Print the compiler
D Store arrays
Show Answer
Correct Answer:
A) Handle exceptional or invalid cases early
A Create recursion
B Prevent fall-through to the next case
C Read input
D Initialize variables
Show Answer
Correct Answer:
B) Prevent fall-through to the next case
A A function returns a value
B Execution continues into the next case without stopping
C A variable changes type
D The monitor turns off
Show Answer
Correct Answer:
B) Execution continues into the next case without stopping
A Store decimal fractions only
B Remember whether a condition/event has occurred
C Replace all loops
D Open files
Show Answer
Correct Answer:
B) Remember whether a condition/event has occurred
A A device driver
B One of two values based on a condition
C Only loop counts
D Object files
Show Answer
Correct Answer:
B) One of two values based on a condition
A n % 2 == 0
B n / 2 == 0
C n > 2
D n += 2
Show Answer
Correct Answer:
A) n % 2 == 0
A Only arrays
B Selection structures to respond to user choice
C No input
D Only comments
Show Answer
Correct Answer:
B) Selection structures to respond to user choice
A if-else ladder
B Single character variable only
C File pointer
D Linker
Show Answer
Correct Answer:
A) if-else ladder
A Making them deeper
B Using clearer combined or structured conditions
C Removing all comparisons
D Adding hardware
Show Answer
Correct Answer:
B) Using clearer combined or structured conditions
A marks is assigned 50
B marks is at least 50
C marks becomes Boolean
D marks is less than 50
Show Answer
Correct Answer:
B) marks is at least 50
A Printer model
B Truth value of conditions
C Keyboard color
D File size
Show Answer
Correct Answer:
B) Truth value of conditions
A Typing speed
B Discount eligibility or admission criteria
C Processor manufacturing
D Network cables
Show Answer
Correct Answer:
B) Discount eligibility or admission criteria
A Always executes
B Can never execute because of program logic
C Contains a loop
D Reads input
Show Answer
Correct Answer:
B) Can never execute because of program logic
A Translate source code
B Repeat a set of statements
C Store images
D Declare constants
Show Answer
Correct Answer:
B) Repeat a set of statements
A The condition is true
B The condition is false
C The file is closed
D The compiler warns
Show Answer
Correct Answer:
A) The condition is true
A The number of iterations is known or controlled by a counter
B No repetition is needed
C Writing comments
D Declaring arrays only
Show Answer
Correct Answer:
A) The number of iterations is known or controlled by a counter
A Never checks a condition
B Executes the body at least once
C Cannot use conditions
D Runs only ten times
Show Answer
Correct Answer:
B) Executes the body at least once
A The loop condition never becomes false
B The compiler is updated
C The output is correct
D A function is declared
Show Answer
Correct Answer:
A) The loop condition never becomes false
A Open files
B Track progress of repetition
C Store only strings
D Compile modules
Show Answer
Correct Answer:
B) Track progress of repetition
A Before iterations begin
B After the program ends
C Inside comments
D Inside the linker
Show Answer
Correct Answer:
A) Before iterations begin
A Avoid all output
B Move toward loop termination
C Increase syntax errors
D Create arrays
Show Answer
Correct Answer:
B) Move toward loop termination
A A loop inside another loop
B A loop with no body
C A wrong program always
D A file operation
Show Answer
Correct Answer:
A) A loop inside another loop
A print
B break
C char
D const
Show Answer
Correct Answer:
B) break
A continue
B return type
C compile
D link
Show Answer
Correct Answer:
A) continue
A The user enters a special terminating value
B The CPU shuts down
C A compiler warning appears
D A library is missing
Show Answer
Correct Answer:
A) The user enters a special terminating value
A Store final code only
B Keep a running total
C Create comments
D Count files
Show Answer
Correct Answer:
B) Keep a running total
A Measure monitor size
B Count how many times something occurs
C Store strings
D Allocate memory
Show Answer
Correct Answer:
B) Count how many times something occurs
A Sentinel-controlled while loop
B Switch statement
C Array declaration
D Function prototype
Show Answer
Correct Answer:
A) Sentinel-controlled while loop
A Wrong monitor brightness
B Incorrect start or stop conditions
C Too many comments
D File permissions
Show Answer
Correct Answer:
B) Incorrect start or stop conditions
A Never matters
B Remains true before and after each iteration
C Ends the loop instantly
D Stores dynamic memory
Show Answer
Correct Answer:
B) Remains true before and after each iteration
A Finding sum of 100 numbers
B Declaring one variable
C Writing a comment
D Closing a file once
Show Answer
Correct Answer:
A) Finding sum of 100 numbers
A The loop condition and updates
B Only variable names
C Only comments
D The color theme
Show Answer
Correct Answer:
A) The loop condition and updates
A An accumulator multiplied each iteration
B Only input statements
C A switch with no cases
D A file pointer
Show Answer
Correct Answer:
A) An accumulator multiplied each iteration
A At least once
B Zero times
C Exactly once
D Infinite times only
Show Answer
Correct Answer:
B) Zero times
A Before the outer loop starts
B For each iteration of the outer loop
C Only once at the end
D Never
Show Answer
Correct Answer:
B) For each iteration of the outer loop
A for loop
B switch statement
C comment block
D linker phase
Show Answer
Correct Answer:
A) for loop
A A loop until valid data is entered
B Only a constant
C A pointer arithmetic rule
D A header file
Show Answer
Correct Answer:
A) A loop until valid data is entered
A Reduces total randomly
B Adds each new value to a running sum
C Creates a new variable each time
D Ends the loop
Show Answer
Correct Answer:
B) Adds each new value to a running sum
A Only one value always
B Multiple values of the same general type under one name
C Only characters
D Only files
Show Answer
Correct Answer:
B) Multiple values of the same general type under one name
A Password
B Index or position
C Compiler phase
D File extension
Show Answer
Correct Answer:
B) Index or position
A 1
B 0
C -1
D Depends only on hardware
Show Answer
Correct Answer:
B) 0
A Randomly
B Contiguously
C Only in ROM
D Inside comments
Show Answer
Correct Answer:
B) Contiguously
A Its color
B Number of elements it can hold
C Its address
D Its data type only
Show Answer
Correct Answer:
B) Number of elements it can hold
A Always be safe
B Cause errors or undefined behavior
C Print the entire array
D Increase speed
Show Answer
Correct Answer:
B) Cause errors or undefined behavior
A Deleting it
B Processing elements one by one
C Compiling it
D Linking libraries
Show Answer
Correct Answer:
B) Processing elements one by one
A Store a collection of marks or prices
B Replace all conditions
C Translate source code
D Control the printer
Show Answer
Correct Answer:
A) Store a collection of marks or prices
A Determines safe iteration limits
B Changes the keyboard layout
C Makes all values equal
D Removes loops
Show Answer
Correct Answer:
A) Determines safe iteration limits
A Checking elements one by one
B Using only recursion
C Comparing first and last only
D Sorting automatically
Show Answer
Correct Answer:
A) Checking elements one by one
A The correct index
B A new compiler
C A file stream
D No assignment
Show Answer
Correct Answer:
A) The correct index
A Only a sentence
B A table or matrix of rows and columns
C A single Boolean
D A compiled executable
Show Answer
Correct Answer:
B) A table or matrix of rows and columns
A One row only
B Element at row i and column j
C Entire file
D A function call
Show Answer
Correct Answer:
B) Element at row i and column j
A Columns first always
B All columns of a row before moving to the next row
C Random cells only
D Only diagonal values
Show Answer
Correct Answer:
B) All columns of a row before moving to the next row
A Append/insert at end
B Compile
C Dereference
D Deallocate
Show Answer
Correct Answer:
A) Append/insert at end
A Related information is stored in separate arrays with matching indices
B Arrays are always unequal
C Files are merged
D Using recursion only
Show Answer
Correct Answer:
A) Related information is stored in separate arrays with matching indices
A Multiplying all values
B Summing values then dividing by count
C Taking the first value
D Using a switch
Show Answer
Correct Answer:
B) Summing values then dividing by count
A The address/location of the first element
B The last element only
C A compiler error
D A string constant only
Show Answer
Correct Answer:
A) The address/location of the first element
A 3×5 or 5×3 two-dimensional array
B Single Boolean variable
C Only one integer
D A switch statement
Show Answer
Correct Answer:
A) 3×5 or 5×3 two-dimensional array
A Element-wise processing or a built-in copy mechanism
B No effort
C Only a comment
D A linker
Show Answer
Correct Answer:
A) Element-wise processing or a built-in copy mechanism
A Deleting repeated elements always
B Arranging elements in a desired order
C Printing one value
D Reading from file
Show Answer
Correct Answer:
B) Arranging elements in a desired order
Show Answer
Correct Answer:
C) n-1
A All rows have exactly same length
B Rows may have different lengths
C It stores only strings
D It cannot be traversed
Show Answer
Correct Answer:
B) Rows may have different lengths
A The monitor size
B Its length/size information
C A printer command
D Only comments
Show Answer
Correct Answer:
B) Its length/size information
A An array of counts
B A single if statement
C Only a string
D No memory
Show Answer
Correct Answer:
A) An array of counts
A Break a program into reusable modules
B Replace all variables
C Store images only
D Stop compilation
Show Answer
Correct Answer:
A) Break a program into reusable modules
A Only the function name
B The code that specifies what the function does
C Only comments
D Only return statement
Show Answer
Correct Answer:
B) The code that specifies what the function does
A Deleting the function
B Invoking the function to execute
C Changing hardware
D Saving a file
Show Answer
Correct Answer:
B) Invoking the function to execute
A A value supplied to printer
B A variable in the function header receiving input
C An output window
D A bug type
Show Answer
Correct Answer:
B) A variable in the function header receiving input
A The actual value passed to a function
B The same as comment
C A reserved keyword always
D A stack frame only
Show Answer
Correct Answer:
A) The actual value passed to a function
A Text written in comments
B The result sent back by a function
C Always an integer
D The function name
Show Answer
Correct Answer:
B) The result sent back by a function
A Returns no explicit value
B Returns many values
C Cannot be called
D Must read files
Show Answer
Correct Answer:
A) Returns no explicit value
A Code organization and reusability
B Syntax errors
C Hardware temperature
D Typing noise
Show Answer
Correct Answer:
A) Code organization and reusability
A Everywhere in the program
B Only inside the function/block where they are declared
C Only in libraries
D Only after compilation
Show Answer
Correct Answer:
B) Only inside the function/block where they are declared
A Within a wider program scope
B Only inside one loop
C Only in comments
D Never
Show Answer
Correct Answer:
A) Within a wider program scope
A Calls itself directly or indirectly
B Contains no parameters
C Uses only arrays
D Has no return value
Show Answer
Correct Answer:
A) Calls itself directly or indirectly
A Makes recursion infinite
B Stops recursive calls eventually
C Stores global memory
D Creates object code
Show Answer
Correct Answer:
B) Stops recursive calls eventually
A Printers and scanners
B Active function calls and local data
C Only global variables
D Comments
Show Answer
Correct Answer:
B) Active function calls and local data
A New calls are added
B Functions finish and return back through previous calls
C A file is opened
D The program is compiled
Show Answer
Correct Answer:
B) Functions finish and return back through previous calls
A The full algorithm always
B The function name, return type, and parameters before use
C The file path
D The monitor model
Show Answer
Correct Answer:
B) The function name, return type, and parameters before use
A The function receives a copy of the argument
B The original variable is always changed
C No memory is used
D Only arrays can be passed
Show Answer
Correct Answer:
A) The function receives a copy of the argument
A Ignore the argument
B Modify the original variable
C Run without parameters
D Avoid return statements
Show Answer
Correct Answer:
B) Modify the original variable
A Produces output without side effects for same input
B Uses global variables heavily
C Always reads files
D Never returns a result
Show Answer
Correct Answer:
A) Produces output without side effects for same input
A Increase duplication
B Encapsulate repeated tasks
C Prevent testing
D Replace loops
Show Answer
Correct Answer:
B) Encapsulate repeated tasks
A One giant function of 500 lines
B Small focused functions with clear purpose
C A function with no name
D Only recursive functions
Show Answer
Correct Answer:
B) Small focused functions with clear purpose
A Rewrite formula everywhere
B Create a reusable function
C Use only global variables
D Use switch
Show Answer
Correct Answer:
B) Create a reusable function
A Arguments to be omitted when suitable default values exist
B Functions to return multiple types always
C No compilation
D No parameters ever
Show Answer
Correct Answer:
A) Arguments to be omitted when suitable default values exist
A One name can have multiple parameter variations
B A function crashes the stack
C Functions use too much memory
D The linker is skipped
Show Answer
Correct Answer:
A) One name can have multiple parameter variations
A Very deep or infinite recursion
B Too many comments
C Using constants
D Reading one integer
Show Answer
Correct Answer:
A) Very deep or infinite recursion
A Handle invalid cases clearly
B Avoid all logic
C Replace parameters
D Create dynamic memory
Show Answer
Correct Answer:
A) Handle invalid cases clearly
A A single numeric value
B A sequence of characters
C A Boolean flag
D A loop counter
Show Answer
Correct Answer:
B) A sequence of characters
A Double the length
B Mark the end of the string
C Store the first character
D Begin a file
Show Answer
Correct Answer:
B) Mark the end of the string
A Its memory address
B Number of characters it contains
C Its first index only
D Its file size
Show Answer
Correct Answer:
B) Number of characters it contains
A Comparing two strings
B Joining strings together
C Sorting characters
D Deleting spaces
Show Answer
Correct Answer:
B) Joining strings together
A Two strings have same or ordered content
B Both are integers
C They use same memory size only
D A file exists
Show Answer
Correct Answer:
A) Two strings have same or ordered content
A A whole program
B A part of a string
C A compiler message
D A type of pointer only
Show Answer
Correct Answer:
B) A part of a string
A Deleting the string
B Processing characters one by one
C Converting to float only
D Opening a text file
Show Answer
Correct Answer:
B) Processing characters one by one
A Counting vowels
B Allocating CPU
C Linking modules
D Changing RAM type
Show Answer
Correct Answer:
A) Counting vowels
A Only letters
B Spaces, tabs, and newline characters
C Numbers only
D Comments only
Show Answer
Correct Answer:
B) Spaces, tabs, and newline characters
A Buffer size limitations or leftover newline input
B The CPU disappears
C Functions stop existing
D Arrays cannot store chars
Show Answer
Correct Answer:
A) Buffer size limitations or leftover newline input
A Numbers to files
B Uppercase letters to lowercase or vice versa
C Strings to arrays only
D Pointers to references
Show Answer
Correct Answer:
B) Uppercase letters to lowercase or vice versa
A Differently backward
B The same forward and backward
C Only left to right
D Only in binary
Show Answer
Correct Answer:
B) The same forward and backward
A Random order
B Dictionary order
C Reverse memory order
D Loop order
Show Answer
Correct Answer:
B) Dictionary order
A All characters
B Unwanted spaces from beginning/end
C The null terminator only
D Middle letters only
Show Answer
Correct Answer:
B) Unwanted spaces from beginning/end
A Reading until whitespace only
B A method that accepts spaces
C Only integer input
D No variables
Show Answer
Correct Answer:
B) A method that accepts spaces
A Cannot be changed
B Can be modified after creation
C Exists only in files
D Is always global
Show Answer
Correct Answer:
B) Can be modified after creation
A Only the last character
B Individual characters by position
C The compiler state
D The function return type
Show Answer
Correct Answer:
B) Individual characters by position
A Memory allocation
B Special character representations like newline
C Array sorting
D Logical operations
Show Answer
Correct Answer:
B) Special character representations like newline
A Only the first character
B Spaces/separators and transitions between words
C Only digits
D The linker output
Show Answer
Correct Answer:
B) Spaces/separators and transitions between words
A User names and messages
B CPU clock speed
C Printer cables
D Heat sink design
Show Answer
Correct Answer:
A) User names and messages
A Enough storage space in the destination
B Only screen size
C Only compiler version
D Nothing
Show Answer
Correct Answer:
A) Enough storage space in the destination
A Reading and extracting meaningful pieces from text
B Deleting all text
C Compiling comments
D Closing files
Show Answer
Correct Answer:
A) Reading and extracting meaningful pieces from text
A Character array or string object
B Only integer variable
C Switch case
D A pointer to CPU
Show Answer
Correct Answer:
A) Character array or string object
A A hidden bug
B A character separating parts, such as comma
C A loop index
D A return type
Show Answer
Correct Answer:
B) A character separating parts, such as comma
A A sorted list
B The characters in opposite order
C A numeric result only
D A file stream
Show Answer
Correct Answer:
B) The characters in opposite order
A A character only
B The address of another variable
C A compiled program
D A loop condition
Show Answer
Correct Answer:
B) The address of another variable
A Get the memory address of a variable
B Multiply values
C Create files
D Display output
Show Answer
Correct Answer:
A) Get the memory address of a variable
A Destroying it
B Accessing the value stored at the pointed address
C Compiling it
D Comparing it with a string
Show Answer
Correct Answer:
B) Accessing the value stored at the pointed address
A Points to valid data
B Does not currently point to a valid object
C Stores text
D Always points to zero index array
Show Answer
Correct Answer:
B) Does not currently point to a valid object
A Be perfectly safe always
B Cause serious runtime errors
C Improve efficiency
D Remove syntax errors
Show Answer
Correct Answer:
B) Cause serious runtime errors
A A function should modify the original argument efficiently
B No parameters exist
C Only strings are used
D Writing comments
Show Answer
Correct Answer:
A) A function should modify the original argument efficiently
A Another name for an existing variable
B A new unrelated variable
C A file descriptor
D A keyword for loops
Show Answer
Correct Answer:
A) Another name for an existing variable
A Only keyboard type
B The size of the pointed data type
C Comment length
D Compiler theme
Show Answer
Correct Answer:
B) The size of the pointed data type
A A Boolean value
B A pointer to its first element
C A string literal
D A file stream
Show Answer
Correct Answer:
B) A pointer to its first element
A Pointer p becomes ten
B The value at address stored in p becomes 10
C p is compared with 10
D A file is closed
Show Answer
Correct Answer:
B) The value at address stored in p becomes 10
A Dereference before initialization
B Initialize pointers properly before use
C Point to random memory
D Ignore null checks
Show Answer
Correct Answer:
B) Initialize pointers properly before use
A A pointer to currently valid memory
B A pointer to memory that is no longer valid
C A pointer stored globally
D A constant pointer only
Show Answer
Correct Answer:
B) A pointer to memory that is no longer valid
A The value pointed to cannot change
B The pointer address itself cannot change after initialization
C It stores only constants
D It cannot be dereferenced
Show Answer
Correct Answer:
B) The pointer address itself cannot change after initialization
A The pointed value should not be modified through that pointer
B The pointer cannot move
C The address is zero
D The data is dynamic
Show Answer
Correct Answer:
A) The pointed value should not be modified through that pointer
A Can be null freely
B Usually must refer to a valid object once bound
C Use no memory
D Replace arrays
Show Answer
Correct Answer:
B) Usually must refer to a valid object once bound
A Storing an address for dynamic memory
B Adding two integers
C Writing a comment
D Displaying a menu
Show Answer
Correct Answer:
A) Storing an address for dynamic memory
A Subtract numbers
B Access members through a pointer to a structure/object
C Create loops
D Open files
Show Answer
Correct Answer:
B) Access members through a pointer to a structure/object
A Two names refer to the same memory location
B A variable becomes constant
C A string is reversed
D A file is renamed
Show Answer
Correct Answer:
A) Two names refer to the same memory location
A Is recreated from scratch on every call only
B Retains its value between function calls
C Exists only in arrays
D Cannot be initialized
Show Answer
Correct Answer:
B) Retains its value between function calls
A Local non-static variables
B Executable files
C Global constants only
D Headers
Show Answer
Correct Answer:
A) Local non-static variables
A Proper initialization
B Dereferencing null or invalid pointers
C Using comments
D Declaring integers
Show Answer
Correct Answer:
B) Dereferencing null or invalid pointers
A Pointers or references
B Only comments
C A compiler flag
D A string literal
Show Answer
Correct Answer:
A) Pointers or references
A Independent of pointed value content but dependent on platform
B Always 1 byte
C Always equal to array length
D Always larger than RAM
Show Answer
Correct Answer:
A) Independent of pointed value content but dependent on platform
A Nowhere
B In memory like other variables
C Only in the CPU forever
D Inside the linker
Show Answer
Correct Answer:
B) In memory like other variables
A The pointer refers to dynamically allocated valid memory
B The value is printed
C The compiler is closed
D The monitor is on
Show Answer
Correct Answer:
A) The pointer refers to dynamically allocated valid memory
A Only at compile time
B At runtime as needed
C Only from ROM
D Only by the linker
Show Answer
Correct Answer:
B) At runtime as needed
A The required size is known exactly at compile time always
B Data size is determined during execution
C No variables exist
D Only integers are used
Show Answer
Correct Answer:
B) Data size is determined during execution
A Allocated memory is not released after it is no longer needed
B A file is renamed
C The compiler optimizes code
D A loop ends
Show Answer
Correct Answer:
A) Allocated memory is not released after it is no longer needed
A Waste resources
B Return memory to the system
C Create strings
D Start recursion
Show Answer
Correct Answer:
B) Return memory to the system
A The pointer becomes longer
B Using the freed memory again through a dangling pointer
C Comments disappear
D Arrays become 2D
Show Answer
Correct Answer:
B) Using the freed memory again through a dangling pointer
A Array size must change or be decided at runtime
B The size is always fixed and tiny
C No loops are used
D Only chars are stored
Show Answer
Correct Answer:
A) Array size must change or be decided at runtime
A Temporary CPU storage only
B Storing data permanently on secondary storage
C Compiling code
D Drawing flowcharts
Show Answer
Correct Answer:
B) Storing data permanently on secondary storage
A Create new processor instructions
B Retrieve data from an existing file
C Only write data
D Delete memory
Show Answer
Correct Answer:
B) Retrieve data from an existing file
A Leaves contents unchanged always
B Creates a new file or overwrites existing content
C Reads without change only
D Runs the compiler
Show Answer
Correct Answer:
B) Creates a new file or overwrites existing content
A Add new data at the end of an existing file
B Read only the first line
C Delete the file
D Allocate RAM
Show Answer
Correct Answer:
A) Add new data at the end of an existing file
A Check that the file opened successfully
B Restart the computer
C Create recursion
D Sort arrays
Show Answer
Correct Answer:
A) Check that the file opened successfully
A End of File
B Error on Format
C Entry of Function
D Execution of File
Show Answer
Correct Answer:
A) End of File
A Human-readable characters
B Raw machine addresses only
C GPU signals
D Pointers only
Show Answer
Correct Answer:
A) Human-readable characters
A Cannot store data
B Store raw bytes in compact form
C Use only strings
D Need no opening
Show Answer
Correct Answer:
B) Store raw bytes in compact form
A The current position and state during file operations
B Only file size
C Only variable names
D The compiler version
Show Answer
Correct Answer:
A) The current position and state during file operations
A A loop until end of file or read failure
B A switch with no cases
C Only recursion
D No variables
Show Answer
Correct Answer:
A) A loop until end of file or read failure
A Persistent reports and saved data
B Reducing algorithm logic
C Deleting memory
D Avoiding all debugging
Show Answer
Correct Answer:
A) Persistent reports and saved data
A May flush buffers and release resources
B Creates a syntax error
C Deletes all data automatically
D Prevents any output
Show Answer
Correct Answer:
A) May flush buffers and release resources
A Turning structured data into a storable/transmittable format
B Sorting only numbers
C Creating arrays
D Compiling libraries
Show Answer
Correct Answer:
A) Turning structured data into a storable/transmittable format
A Blind trust
B Basic validation and error handling
C Pointer arithmetic only
D Ignoring existence
Show Answer
Correct Answer:
B) Basic validation and error handling
A Pointers
B Comments
C Switch labels
D Only constants
Show Answer
Correct Answer:
A) Pointers
A Moving/copying existing data to a new location
B Deleting all variables
C Using only files
D Changing comments
Show Answer
Correct Answer:
A) Moving/copying existing data to a new location
A Saving student marks or inventory records
B Cooling the CPU
C Producing machine code
D Replacing operators
Show Answer
Correct Answer:
A) Saving student marks or inventory records
A Parsing according to the stored format
B Only a monitor
C No loops
D No variables
Show Answer
Correct Answer:
A) Parsing according to the stored format
A Buffered data not being fully written
B Improved security
C No effect ever
D Compiler warnings only
Show Answer
Correct Answer:
A) Buffered data not being fully written
A Selection logic
B Only file I/O
C Only recursion
D A pointer to char
Show Answer
Correct Answer:
A) Selection logic
A The product of marks
B The sum of marks and divide by count
C Only the maximum
D Only the minimum
Show Answer
Correct Answer:
B) The sum of marks and divide by count
A A counter and repetition
B Only a switch
C No variables
D Only dynamic memory
Show Answer
Correct Answer:
A) A counter and repetition
A Selection structure
B Pointer arithmetic
C File append only
D Static memory
Show Answer
Correct Answer:
A) Selection structure
A Loop with remainder and division
B Only arrays
C Only recursion always
D File reading
Show Answer
Correct Answer:
A) Loop with remainder and division
A if-else ranges
B Only a compiler flag
C Only string trimming
D Pointer subtraction
Show Answer
Correct Answer:
A) if-else ranges
A Specific divisibility conditions
B Only addition
C Only file mode
D A random choice
Show Answer
Correct Answer:
A) Specific divisibility conditions
A An array of counters
B Only one Boolean
C No loops
D Only comments
Show Answer
Correct Answer:
A) An array of counters
A Unsorted
B Sorted
C Stored in a file only
D In two dimensions
Show Answer
Correct Answer:
B) Sorted
A Data is unsorted or small
B Data is always huge and sorted
C No comparison is needed
D Only files are used
Show Answer
Correct Answer:
A) Data is unsorted or small
A Execution count and logic correctness
B Only variable names
C Only font style
D Linker options
Show Answer
Correct Answer:
A) Execution count and logic correctness
A Representative input and expected output
B Only variable declarations
C Only comments
D A new compiler
Show Answer
Correct Answer:
A) Representative input and expected output
A Random colors
B Values near the limits of valid input
C Only strings
D Only null pointers
Show Answer
Correct Answer:
B) Values near the limits of valid input
A Whether amount meets valid conditions such as balance and limits
B Only output color
C The file extension
D The array index
Show Answer
Correct Answer:
A) Whether amount meets valid conditions such as balance and limits
A Current item with previous or next item
B Only the first and last item
C Only file names
D Only pointers
Show Answer
Correct Answer:
A) Current item with previous or next item
A A larger value is found
B A smaller value is found
C The loop ends
D A file opens
Show Answer
Correct Answer:
A) A larger value is found
A Nested loops
B Single if statement
C Only recursion
D String concatenation
Show Answer
Correct Answer:
A) Nested loops
A Persist item names, quantities, and prices
B Increase CPU cores
C Replace all functions
D Avoid input
Show Answer
Correct Answer:
A) Persist item names, quantities, and prices
A Modular design
B Machine language
C Only dynamic memory
D A syntax error
Show Answer
Correct Answer:
A) Modular design
A Trace variable values through iterations
B Delete all loops
C Rewrite in assembly immediately
D Ignore test data
Show Answer
Correct Answer:
A) Trace variable values through iterations
A A counted loop with condition
B Only arrays
C Only a pointer
D A static file
Show Answer
Correct Answer:
A) A counted loop with condition
A Repetition and a sentinel value
B No input
C Only recursion
D Only switch
Show Answer
Correct Answer:
A) Repetition and a sentinel value
A Reuse tested functions for repeated tasks
B Copy-paste logic everywhere
C Avoid meaningful names
D Ignore edge cases
Show Answer
Correct Answer:
A) Reuse tested functions for repeated tasks
A A missed edge case
B The monitor brightness
C The linker version
D A comment format
Show Answer
Correct Answer:
A) A missed edge case
A Correct logic, testing, and readable implementation
B Only a final answer without code
C Only diagrams without logic
D Only file output
Show Answer
Correct Answer:
A) Correct logic, testing, and readable implementation
for study
Yes its for study
Programing
Unable to understand your query??
Exams
Good luck for your exams Haseeb…
Exams working
You can use as reference this data for your exam preparations
For studying
Yes its both for study or exam preparations