1.
Which of the following is/are storage class?
Correct Answer
D. All
Explanation
The correct answer is "All" because all the options mentioned - Automatic, Static, and Allocated - are storage classes in programming. Automatic storage class is used to declare variables that have a local scope and are automatically initialized. Static storage class is used to declare variables that retain their values throughout the program's execution. Allocated storage class is used for dynamically allocating memory during runtime. Therefore, all the options mentioned are storage classes.
2.
What will the output of following code
{
int x = 10, y = 15;
x = x++;
y = ++y;
printf(“%d, %d \n”, x, y);
}
Correct Answer
C. 11, 16
Explanation
The output of the code will be 11, 16.
In the line "x = x++", the value of x is incremented by 1 but the assignment happens after the increment, so the value of x remains the same (10).
In the line "y = ++y", the value of y is incremented by 1 and then assigned to y, so the value of y becomes 16.
3.
NULL Pointer can be used as:
Correct Answer
D. All
Explanation
A NULL pointer can be used in multiple ways. Firstly, it can be used to stop indirection in a recursive data structure, where a NULL pointer indicates the end of the structure. Secondly, it can be used as an error value, where a NULL pointer signifies that an error has occurred. Lastly, a NULL pointer can also be used as a sentinel value, which is a special value used to mark the end of a list or data structure. Therefore, the correct answer is that a NULL pointer can be used for all of these purposes.
4.
Which one of the following is not the advantages of functions?
Correct Answer
D. It consumes low disk space
Explanation
The given answer states that "It consumes low disk space" is not an advantage of functions. This is because the amount of disk space used by functions is not related to their advantages. Functions are primarily used for modularizing code, improving code reusability, and enhancing code readability. They help in organizing code into smaller, manageable chunks, making debugging and testing easier. Recursive calls are also possible with functions, allowing for efficient problem-solving techniques. However, the amount of disk space consumed by functions is not a factor that contributes to their advantages.
5.
The Do While looping Statement?
Correct Answer
C. Is executed at least once if the condition is false
Explanation
The Do While looping statement is executed at least once if the condition is false. This is because the loop first executes the code block and then checks the condition. If the condition is false, the loop will still execute once before exiting. This makes it different from other looping statements, such as the While loop, which may not execute at all if the condition is false from the beginning.
6.
What is the result of the following statement?
X = 10;
y = ++x;
Correct Answer
D. X = 11, y = 11
Explanation
The statement "y = ++x" is a pre-increment operator, which means it increments the value of x by 1 and then assigns the incremented value to y. So, the value of x becomes 11 and the value of y also becomes 11.
7.
Which of the following statement creates infinite loop?
Correct Answer
A. For ( ; ; )
Explanation
The correct answer is "for ( ; ; )". This statement creates an infinite loop because it does not have any condition to terminate the loop. Without a condition, the loop will continue indefinitely, causing it to run forever.
8.
The use of “break” Statement
Correct Answer
C. Both
Explanation
The "break" statement is used to terminate a case in the switch statement, allowing the program to exit the switch block and continue execution after the switch statement. Additionally, it can also be used to force immediate termination of a loop, causing the program to exit the loop and continue with the next statement after the loop. Therefore, the correct answer is both.
9.
To use the function tolower(), which of the following header file should include
Correct Answer
C. Ctype.h
Explanation
The correct answer is ctype.h. This header file is needed to use the function tolower(), which is used to convert uppercase characters to lowercase in C programming. The ctype.h header file contains various functions for character handling, including tolower().
10.
What is the function overloading?
Correct Answer
B. Having more than one functions of same name
Explanation
Function overloading refers to the ability to have multiple functions with the same name but different parameters or argument types in a programming language. This allows the programmer to define multiple functions with the same name but perform different operations based on the type or number of arguments passed to the function. It provides flexibility and code reusability by allowing the programmer to use a single function name for similar operations with different input parameters.
11.
In the passage of text, individual words and punctuation marks are known as:
Correct Answer
D. Tokens
Explanation
In the passage of text, individual words and punctuation marks are known as tokens. Tokens are the smallest units of meaning in a programming language. They can include keywords, constants, operators, and other elements that make up the syntax of the language. In this context, tokens refer to the individual components that are used to construct the text.
12.
By default, members of a C++ class are
Correct Answer
A. Private
Explanation
In C++, by default, the members of a class are private. This means that they can only be accessed within the class itself and are not accessible from outside the class. Private members are used to encapsulate the internal implementation details of a class and provide data hiding, ensuring that the class's data is only accessed and modified through the class's public interface. Other access specifiers like public and protected can be used to explicitly specify the accessibility of class members.
13.
Which of the following statements is true in C++?
Correct Answer
C. The default access modifier of struct is public
Explanation
In C++, the default access modifier for a struct is public. This means that all members of a struct are accessible from outside the struct. Therefore, the statement "The default access modifier of struct is public" is true in C++.
14.
C++ supports
Correct Answer
D. All
Explanation
C++ supports all of the given options: multiple inheritance, pointer to functions, and recursion. Multiple inheritance allows a class to inherit from multiple base classes, providing flexibility in creating complex class hierarchies. Pointer to functions is a feature in C++ that allows functions to be stored in variables and passed as arguments to other functions. Recursion is a programming technique where a function calls itself, allowing for the solution of complex problems by breaking them down into smaller, more manageable subproblems. Therefore, the correct answer is "All".
15.
Which of the following is not a C++ keyword?
Correct Answer
C. Inherits
16.
Which of the following is not a bitwise operator?
Correct Answer
A. & &
17.
In C++, the expression 5/2 is evaluated to
Correct Answer
B. 2
Explanation
In C++, when dividing two integers, the result is always an integer. In this case, 5 divided by 2 equals 2 with a remainder of 1. Since the result is an integer, the remainder is ignored and the answer is 2.
18.
C++ was originally developed by
Correct Answer
C. Bjarne Stroustrup
Explanation
Bjarne Stroustrup is the correct answer because he is the creator of the C++ programming language. He developed C++ in the early 1980s as an extension of the C programming language. Stroustrup wanted to add object-oriented programming features to C, resulting in the creation of C++. His work on C++ has had a significant impact on the field of programming, making it a widely used language for a variety of applications.
19.
The standard C++ comment
Correct Answer
B. //
Explanation
The correct answer is "//" because it is the standard C++ comment syntax. It is used to comment out a single line of code. The other options ("/", "/* and */", and "None of these") are not the correct syntax for commenting in C++.
20.
The preprocessor directive #include<iostream.h> is required if
Correct Answer
C. Both console input and output is used
Explanation
The preprocessor directive #include is required if both console input and output is used. This directive allows the program to access the input and output stream objects defined in the iostream library, which are necessary for reading input from the console and displaying output on the console.
21.
The operator << is called
Correct Answer
C. Either a or b
Explanation
The operator "
22.
What is a reference?
Correct Answer
B. A reference is an alias for an object
Explanation
A reference is an alias for an object, meaning that it is another name for the same object in memory. It allows us to access and manipulate the object using a different name. This can be useful when we want to have multiple names for the same object or when we want to pass objects to functions without making copies of them.
23.
A constructor is called whenever
Correct Answer
A. A object is declared
Explanation
A constructor is a special method that is automatically called when an object is created or declared. It is used to initialize the object's state or perform any necessary setup tasks. Therefore, the correct answer is "a object is declared" because that is when the constructor is called to create and initialize the object.
24.
Overload function in C++
Correct Answer
A. A group function with the same name
Explanation
The correct answer is a group function with the same name. In C++, the concept of function overloading allows multiple functions to have the same name but with different parameters. This means that you can have multiple functions with the same name but with different numbers or types of arguments. This allows for more flexibility and convenience when writing code, as you can use the same function name for related tasks but with different input parameters.
25.
Operator overloading is
Correct Answer
D. Making C++ operators works with objects and giving new meaning to existing C++ operators
Explanation
Operator overloading in C++ refers to the ability to redefine how operators work with objects. This allows programmers to use operators such as +, -, *, /, etc., with user-defined objects, enabling them to perform operations specific to those objects. Additionally, operator overloading also allows programmers to give new meanings or behaviors to existing operators, providing more flexibility and customization in their code.
26.
A constructor is called whenever
Correct Answer
A. A object is declared
Explanation
A constructor is called whenever an object is declared. This is because a constructor is a special method that is automatically invoked when an object of a class is created. It is responsible for initializing the object's state and allocating any necessary resources. Therefore, whenever an object is declared, the constructor is called to perform these tasks.
27.
A class having no name
Correct Answer
C. Can’t have a destructor
Explanation
A class having no name cannot have a destructor because a destructor is a special member function that is automatically called when an object of the class is destroyed. Since the class has no name, it means that there are no objects of that class to be destroyed, hence there is no need for a destructor.
28.
The differences between constructors and destructor are
Correct Answer
C. Both
Explanation
Both statements are correct. Constructors can take arguments, allowing for the initialization of objects with specific values. On the other hand, destructors cannot take any arguments, as their purpose is to clean up resources and memory allocated by the object. Additionally, constructors can be overloaded, meaning that multiple constructors with different parameters can be defined in a class. However, destructors cannot be overloaded as there can only be one destructor per class.
29.
A destructor takes
Correct Answer
D. Zero arguments
Explanation
A destructor is a special member function in a class that is used to clean up the resources allocated by an object when it is destroyed. It is called automatically when an object goes out of scope or is explicitly deleted. In C++, a destructor does not take any arguments. Its purpose is to release memory, close files, or perform any other necessary cleanup operations. Therefore, the correct answer is "Zero arguments".
30.
Constructors are used to
Correct Answer
A. Initialize the objects
Explanation
Constructors are special member functions in a class that are used to initialize the objects of that class. They are called automatically when an object is created and are responsible for setting the initial values of the data members of the object. Therefore, constructors are used to initialize the objects.
31.
In C++ a function contained within a class is called
Correct Answer
A. A member function
Explanation
In C++, a function contained within a class is called a member function. This is because it is a function that is defined and declared within the scope of a class. Member functions have access to the private and protected members of the class and can be called using an object of the class. They are used to perform specific operations or actions on the data members of the class.
32.
What is the current standard for expansion slots on a motherboard?
Correct Answer
B. PCIe (PCI Express)
Explanation
PCIe (PCI Express) is the current standard for expansion slots on a motherboard. It is a high-speed serial interface that provides faster data transfer rates and more bandwidth compared to the older PCI and ISA standards. PCIe allows for faster communication between the motherboard and expansion cards, such as graphics cards, network cards, and storage controllers. It has become the standard choice for modern motherboards due to its improved performance and scalability. FireWire is a different type of interface used for connecting external devices, while ISA is an older standard that is no longer commonly used.
33.
Which hardware component serves as the circuit board that provides electrical connections by which all other components communicate?
Correct Answer
C. Motherboard
Explanation
The motherboard serves as the circuit board that provides electrical connections by which all other components communicate. It is the main printed circuit board in a computer that houses the CPU, RAM, and other essential components. The motherboard acts as a central hub, allowing data and power to flow between all the hardware components, facilitating communication and coordination among them. Without a motherboard, the various hardware components would not be able to communicate with each other effectively.
34.
Which is NOT a common component to be integrated into a motherboard?
Correct Answer
D. Hard drive
Explanation
A hard drive is not a common component to be integrated into a motherboard. While sound cards, video cards, and network cards are commonly integrated into motherboards to enhance the audio, video, and networking capabilities of a computer, a hard drive is typically a separate component that is connected to the motherboard via cables. It is responsible for storing and retrieving data, but it is not directly integrated into the motherboard itself.
35.
The purpose of RAM is to:
Correct Answer
D. Provide temporary, volatile storage
Explanation
RAM, or Random Access Memory, is a type of computer memory that is used to temporarily store data that is actively being used by the computer's processor. It is called "temporary" because its contents are lost when the computer is powered off or restarted. It is also referred to as "volatile" because it requires a constant supply of power to retain its data. Therefore, the purpose of RAM is to provide temporary, volatile storage for the computer to quickly access and manipulate data during its operation.
36.
What is the latest standard in RAM that new motherboards are supporting?
Correct Answer
C. DDR3
Explanation
The latest standard in RAM that new motherboards are supporting is DDR3. DDR3 stands for Double Data Rate 3, which is an improved version of DDR2 RAM. It offers higher bandwidth and faster data transfer rates compared to its predecessor. DDR3 RAM modules are widely used in modern computers and are compatible with newer motherboards.
37.
What is the current standard interface for connecting internal hard drives to the motherboard in desktop computers?
Correct Answer
D. SATA
Explanation
SATA (Serial ATA) is the current standard interface for connecting internal hard drives to the motherboard in desktop computers. It has replaced older interfaces like EIDE and SCSI due to its faster data transfer rates, improved performance, and smaller cables. SATA offers higher bandwidth and supports hot swapping, making it the preferred choice for modern desktop computers. USB, on the other hand, is primarily used for connecting external devices, while EIDE and SCSI are outdated interfaces that are no longer widely used in new computer systems.
38.
Which is NOT a common interface for connecting an external hard drive to a computer?
Correct Answer
D. All of these are common interfaces
Explanation
All of these options are common interfaces for connecting an external hard drive to a computer. This means that none of these options are NOT a common interface for connecting an external hard drive to a computer. Therefore, the correct answer is "All of these are common interfaces."
39.
What will be the output of the following program?
#include<stdio.h>
int main()
{
char numbers[5][6] = {"Zero","One","Two","Three","Four"};
printf("%s is %c",&numbers[4][0],numbers[0][0]);
return 0;
}
Correct Answer
A. Four is Z
Explanation
The program declares and initializes a 2D character array called "numbers" with 5 rows and 6 columns. The elements of the array are strings representing the numbers from "Zero" to "Four".
In the printf statement, it prints the character at the first index (0) of the string at the 4th row (index 4) and the character at the first index (0) of the string at the 0th row (index 0).
Therefore, the output of the program will be "Four is Z".
40.
What will be the output of the following program?
#include<stdio.h>
int main()
{
int a = 1, b = 2, c = 3;
printf("The value of a is %d", ++a);
func();
printf(" The value of a is %d", ++a);
return 0;
}
void func()
{
int a = 10;
return 0;
}
Correct Answer
B. The value of a is 2 The value of a is 3
Explanation
The output of the program will be "The value of a is 2 The value of a is 3".
In the main function, the value of 'a' is incremented by 1 before it is printed, so the first printf statement will print "The value of a is 2".
Then, the function 'func' is called, but it does not have any effect on the value of 'a' in the main function.
After that, the second printf statement in the main function will print "The value of a is 3" because 'a' was incremented again before it was printed.
41.
What is the keyword used to turn off the compiler optimization of a variable?
Correct Answer
B. Volatile
Explanation
The keyword "volatile" is used to turn off the compiler optimization of a variable. When a variable is declared as volatile, it informs the compiler that the variable's value can change at any time, even if it appears that there are no changes in the code. This prevents the compiler from optimizing the variable by caching its value in a register, ensuring that the variable is always read from memory. This is particularly useful when dealing with variables that are shared between multiple threads or accessed by hardware interrupts.
42.
Which one of the following is the correct way of declaring main() function when it receives command line arguments?
Correct Answer
D. Main(int argc,char* argv[ ])
Explanation
The correct way of declaring the main() function when it receives command line arguments is "main(int argc,char* argv[ ])". In C and C++, the main() function can accept command line arguments through two parameters: argc and argv. The "argc" parameter represents the number of command line arguments passed to the program, while the "argv" parameter is an array of strings that contains the actual arguments. Therefore, the correct declaration should include the "int" type for argc and "char*" type for argv.
43.
What is the correct value to return to the operating system upon the successful completion of a program?
Correct Answer
A. 0
Explanation
Upon the successful completion of a program, the correct value to return to the operating system is 0. This is a standard convention in many programming languages and operating systems. Returning 0 indicates that the program executed successfully without any errors or issues.
44.
What is the only function all C programs must contain?
Correct Answer
D. Main ( )
Explanation
The correct answer is "main()". In C programming, the "main()" function is the entry point of the program. It is the function where the program starts its execution. Every C program must have a "main()" function in order to run. Without the "main()" function, the program will not be able to execute any code. It is the mandatory function that serves as the starting point for the program's execution.
45.
What punctuation must be used to end lines of C++ code?
Correct Answer
C. ; (semi-colon)
Explanation
In C++ programming language, lines of code must be ended with a semi-colon (;) punctuation mark. This is known as the statement terminator in C++ and it indicates the end of a line of code. It is important to include this punctuation to ensure that the code is syntactically correct and can be compiled and executed properly.
46.
Which of the following is a correct comment?
Correct Answer
B. /* Comment */
Explanation
The correct comment is /* Comment */. This is because it is written in the format of a C-style comment, which is enclosed between /* and */. This format is commonly used in programming languages like C, C++, and Java to add comments in the code that are ignored by the compiler or interpreter.
47.
Which of the following is not a correct variable type?
Correct Answer
D. Real
Explanation
The variable type "real" is not a correct variable type in many programming languages. The correct variable types in this context are double, float, and int. "Real" is not a recognized variable type and is likely included as a distractor in this question.
48.
Which of the following is the correct operator to compare two variables?
Correct Answer
B. = =
Explanation
The correct operator to compare two variables is "==" in many programming languages. This operator checks if the values of two variables are equal. The double equals sign is used to differentiate it from the assignment operator "=" which is used to assign a value to a variable. Therefore, "==" is the correct operator for comparing two variables.
49.
Which of the following is the Boolean operator for logical and?
Correct Answer
B. & &
Explanation
The correct answer is "& &". The ampersand symbol "&" is the Boolean operator for logical and. It is used to combine two or more conditions in a logical statement, and it returns true only if all the conditions are true.
50.
The directives for the preprocessors begin with
Correct Answer
D. Number Sign (#)
Explanation
The correct answer is the number sign (#). Preprocessor directives in programming languages, such as C or C++, typically start with the number sign symbol. These directives are used to give instructions to the preprocessor, which is a tool that modifies the source code before it is compiled. The number sign symbol is commonly used to include header files, define constants, and perform other preprocessor tasks.