Programming MCQS

A. Print format
B. Print function
C. Print file
D. Print formatted output
A. int
B. char
C. real
D. double
A. Returns size of a variable
B. Returns ASCII value
C. Returns the memory address
D. Returns pointer size
A. // Comment
B. /* Comment */
C. # Comment
D. -- Comment
A. 16
B. 11
C. 10
D. 13
A. const
B. constant
C. Const
D. #define
A. Exit the program
B. Skip to the next case
C. Exit the loop
D. Terminate the switch statement
A. function myFunction()
B. def myFunction():
C. void myFunction()
D. myFunction()
A. Allocate memory for an array
B. Free allocated memory
C. Allocate memory for a variable
D. Allocate and initialize memory for an array
A. Create a new data type
B. Define a variable
C. Declare a function
D. Include a header file
A. %f
B. %d
C. %s
D. %c
A. read()
B. getchar()
C. getc()
D. scanf()
A. A
B. B
C. 66
D. 67
A. int* ptr;
B. pointer ptr;
C. *ptr int;
D. ptr* int;
A. Exit the loop
B. Skip to the next iteration
C. Restart the loop
D. Terminate the program
A. #include "file.h"
B. include "file.h"
C. #include
D. include
A. Define a constant
B. Declare a variable
C. Create a static function
D. Preserve variable value between function calls
A. Hello
B. ello
C. H
D. e
A. ->
B. *
C. ::
D. .
A. Read a character
B. Read a string
C. Read an integer
D. Read a float
A. Concatenate strings
B. Copy strings
C. Compare strings
D. Convert strings
A. fopen("file.txt", "r");
B. open("file.txt", "w");
C. fopen("file.txt", "w");
D. open("file.txt", "r");
A. Concatenate strings
B. Copy strings
C. Compare strings
D. Convert strings
A. close(file);
B. fclose(file);
C. file.close();
D. endfile(file);
A. Size of the pointer
B. Size of the data type pointed to
C. Size of the memory allocated
D. Size of the address
A. &&
B.

A. -6
B. 5
C. 6
D. -5
A. Combine two arrays
B. Combine two structures
C. Combine two functions
D. Combine two variables
A. $
B. #
C. @
D. &
A. Allocate memory for an array
B. Free allocated memory
C. Allocate memory for a variable
D. Allocate and initialize memory for an array
A. strcmp()
B. strcompare()
C. compare()
D. stringcmp()
A. A
B. B
C. 65
D. 66
A. const *ptr;
B. *const ptr;
C. const ptr;
D. const int *ptr;
A. Execute the loop at least once
B. Iterate over a range of values
C. Execute the loop until a condition is true
D. Execute the loop based on a condition
A. Declare a volatile variable
B. Indicate an unstable function
C. Declare a constant variable
D. Indicate a variable that can change unexpectedly
A. Generate a random float
B. Generate a random integer
C. Return a fixed value
D. Find the square root
A. global var;
B. int global;
C. extern int global;
D. static global;
A. 3.33
B. 3.0
C. 3
D. 3.333333
A. Compare strings
B. Concatenate strings
C. Copy a specified number of characters from one string to another
D. Convert strings
A. int arr[][];
B. int arr[];
C. int arr[][] = new int[];
D. int arr[][3];
A. Search for a character in a string
B. Search for a string in another string
C. Compare strings
D. Concatenate strings
A. const *ptr;
B. *const ptr;
C. const ptr;
D. const int *ptr;
A. Declare a structure
B. Declare an enumeration
C. Declare a function
D. Declare a variable
A. stdlib.h
B. string.h
C. stdio.h
D. math.h
A. Tokenize a string
B. Compare strings
C. Concatenate strings
D. Copy strings
A. struct myStruct;
B. struct = myStruct;
C. myStruct struct;
D. struct myStruct { };
A. Close a file
B. Terminate the program
C. Return from a function
D. Print a message
A. 4
B. 8
C. 2
D. 1
A. int constant = 5;
B. constant int = 5;
C. const int constant = 5;
D. int constant(5);
A. 20
B. 10
C. 40
D. 5
A. #define MACRO_NAME()
B. define MACRO_NAME():
C. #macro MACRO_NAME
D. #define MACRO_NAME value
A. Get a character without echoing to the screen
B. Get a character with echoing to the screen
C. Get an integer
D. Get a float
A. Declare an automatic variable
B. Declare an automatic pointer
C. Automatically allocate memory
D. Auto-cast variables
A. &
B.

C. ^
A. 1
B. 2
C. 0
D. 3
A. const *ptr;
B. *const ptr;
C. const ptr;
D. const int *const ptr;
A. Compare memory
B. Copy memory
C. Concatenate memory
D. Allocate memory
A. int (*funcPtr)();
B. int funcPtr();
C. (*int funcPtr)();
D. int *funcPtr();
A. 10
B. 20
C. 1
D. 0
A. Concatenate strings
B. Copy strings
C. Compare strings
D. Convert strings
A. int arr[];
B. int arr[10];
C. int *arr = malloc(10 * sizeof(int));
D. int arr[10] = new int[10];
A. a
B. A
C. b
D. B
A. #define MACRO_NAME() { }
B. #define MACRO_NAME { }
C. #macro MACRO_NAME { }
D. #macro MACRO_NAME() { }
A. Flush the keyboard buffer
B. Flush the output buffer
C. Flush the standard input
D. Flush the file stream
A. int (*funcPtr[5])();
B. int funcPtr5;
C. (*int funcPtr[5])();
D. int *funcPtr5;
A. A scripting language
B. A markup language
C. A programming language
D. A database language
A. constant
B. const
C. final
D. static
A. main() method
B. start() method
C. execute() method
D. run() method
A. int
B. float
C. double
D. class
A. Refer to the current object
B. Refer to the parent class
C. Refer to the child class
D. Refer to the global scope
A. new
B. malloc
C. instantiate
D. create
A. true
B. false
C. 0
D. 1
A. Using interfaces
B. Using abstract classes
C. Using multiple extends keyword
D. Java doesn't support multiple inheritance
A. Invoke superclass constructor
B. Refer to the subclass object
C. Invoke a static method
D. Create a superclass instance
A. ArrayList
B. HashSet
C. HashMap
D. Vector
A. Define exceptions
B. Throw exceptions
C. Catch exceptions
D. Propagate exceptions
A. finalize()
B. dispose()
C. clean()
D. destroy()
A. Hello3
B. Hello12
C. Hello21
D. Compile error
A. final
B. static
C. private
D. protected
A. Check if an object is an instance of a class
B. Compare two objects
C. Check if a class is an instance of an object
D. Check if an object is null
A. Abstract class can have constructors
B. Interface can have constructors
C. Abstract class can have abstract methods
D. Interface can have non-abstract methods
A. Skip to the next iteration
B. Exit the loop
C. Restart the loop
D. Skip to the next loop
A. int[] arr;
B. int arr();
C. array arr;
D. array[] arr;
A. using
B. extends
C. implements
D. inheritance
A. 7
B. 8
C. 7.8
D. 8.0
A. Define exceptions
B. Throw exceptions
C. Catch and handle exceptions
D. Propagate exceptions
A. Runnable
B. Serializable
C. Comparable
D. Cloneable
A. Using the run() method
B. Extending the Thread class
C. Implementing the Runnable interface
D. Both B and C
A. Define exceptions
B. Throw exceptions
C. Catch exceptions
D. Cleanup code
A. Create a static method
B. Create a static variable
C. Define a constant
D. Create a static class
A. compare()
B. equals()
C. compareTo()
D. equality()
A. 3.33
B. 3.0
C. 3
D. 3.333333
A. Object obj = new Object();
B. class obj = new class();
C. Object obj = createObject();
D. obj = createObject();
A. Execute the default case
B. Define a default value
C. Provide a default constructor
D. Specify default permissions
A. true
B. false
C. Compile error
D. Runtime error
A. read()
B. input()
C. System.in.read()
D. Scanner.next()
A. Garbage collection
B. Exception handling
C. Object cloning
D. Method overloading
A. const int CONSTANT = 5;
B. final int CONSTANT = 5;
C. static final int CONSTANT = 5;
D. public final int CONSTANT = 5;
A. ArrayList arr = new ArrayList();
B. List arr = new List();
C. List arr = new ArrayList();
D. ArrayList arr = new List();
A. Invoke the superclass constructor
B. Refer to the parent class
C. Invoke the subclass constructor
D. Create a superclass instance