Home / Priyanka Tomar / Programming MCQs Solution

Programming Portal Solution

You will find all Programming Portal MCQs whose solution is updated by Priyanka Tomar

Q. Which of these statements is incorrect?

Q. What will be the output of the following Java code? class exception_handling { public static void main(String args[]) { try { int a = args.length; int b = 10 / a; System.out.print(a); try { if (a

Q. What will be the output of the following Java program? class exception_handling { public static void main(String args[]) { try { System.out.print("Hello" + " " + 1 / 0); } catch(ArithmeticException e) { System.

Q. In Java, can a subclass inherit private constructors from its superclass?

Q. Using which of the following, multiple inheritance in Java can be implemented?

Q. What will be the output of the following Java code? class Output { public static void main(String args[]) { Double y = new Double(257.57812); Double i = new Double(257.578123456789); try { int x = i.compareTo(y); System.out.print(x); }

Q. Which of these method of Object class can generate duplicate copy of the object on which it is called?

Q. Which of these class can generate pseudorandom numbers?

Q. Which of these class have only one field?

Q. Which of these methods of Character wrapper can be used to obtain the char value contained in Character object.

Q. Can "abstract" keyword be used with constructor, Initialization Block, Instance Initialization and Static Initialization Block.

Q. What will be the output of the following Java program? import java.lang.reflect.*; class Additional_packages { public static void main(String args[]) { try { Class c = Class.forName("java.awt.Dimension"); Method methods[] = c.getMethods(); for (int i = 0;

Q. Which of these methods loads the specified dynamic library?

Q. What is the purpose of the "final" keyword in Java?

Q. What will be the output of the following Java program? class Output { public static void main(String args[]) { String str = "true"; boolean x = Boolean.valueOf(str); System.out.print(x); } }

Q. Which of this package is used for analyzing code during run-time?

Q. What will be the output of the following Java program? class Output { public static void main(String args[]) { char a = '@'; boolean x = Character.isLetter(a); System.out.print(x); } }

Q. Which of these keywords is used to define interfaces in Java?

Q. Which of the following is method of wrapper Integer for converting the value of an object into int?

Q. Which of these method of FileReader class is used to read characters from a file?

Q. What will be the output of the following Java program? class Output { public static void main(String args[]) { Integer i = new Integer(257); byte x = i.byteValue(); System.out.print(x); } }

Q. Which of these is a super class of Character wrapper?

Q. What will be the output of the following Java program? class Output { public static void main(String args[]) { Long i = new Long(256); System.out.print(i.hashCode()); } }

Q. Which of these methods return string equivalent of Boolean object?

Q. What is the purpose of the "@Override" annotation in Java?

Q. What is the purpose of the "super" keyword in method overriding?

Q. What is the purpose of the "super" keyword in method overloading?

Q. What is output of the program? class Test{ public void display(int x, double y){ System.out.println(x+y); } public double display(int p, double q){ return (p+q); } public static void main(String args[]){ Test te

Q. Which of this keyword can be used in a subclass to call the constructor of superclass?

Q. What will be the output of the following Java code? class test { int a; int b; test(int i, int j) { a = i; b = j; } void meth(test o) { o.a *= 2; O.b /= 2; } } class Output { public static void main(String args[])

Q. What is the output of the program? class Test{ public int display(int x, int y){ return ("The sum of x and y is " + x + y); } public static void main(String args[]){ Test test = new Test(); System.out.println(tes

Q. What is the output of the above program? class Num { Num(double x ){ System.out.println( x ) ; } } public class Test extends Num { public static void main(String[] args){ Num num = new Num( 2 ) ; } }

Q. Which statement is true about java?

Q. What is Recursion in Java?

Q. Which component is responsible for converting bytecode into machine specific code?

Q. Which of the following has the highest memory requirement?

Q. What will be the output of the following Java program? class box { int width; int height; int length; } class mainclass { public static void main(String args[]) { box obj = new box(); System.out.println(obj); } }

Q. What is true about protected constructor?

Q. What will be the output of the following Java program? class main_class { public static void main(String args[]) { int x = 9; if (x == 9) { int x = 8; System.out.println(x); } } }

Q. Which method can be defined only once in a program?

Q. Which of these is not a correct statement?

Q. Which operator is used for exponentiation in Java?

Q. What is the result of the expression 4 * 2 + 3 in Java?

Q. What is the value of the expression 8 < 6 ? 4 : 2 in Java?

Q. Which of the following is not a decision making statement?

Q. Which of the following is not a valid flow control statement?

Q. What is the output of relational operators?

Q. Which of the following methods is used to compare two strings for equality in Java?

Q. Which of these method of class String is used to remove leading and trailing whitespaces?

Q. What will be the output of the following Java program? class output { public static void main(String args[]) { String s = "Hello World"; int i = s.indexOf('o'); int j = s.lastIndexOf('l'); System.out.print(i + " "

Q. What happens if you try to access an array element at an index that is out of bounds in Java?

Q. Which of these is an incorrect array declaration?

Q. Which keyword is used to define a superclass's method that is overridden by a subclass method?

Q. In Java, what is the purpose of the final keyword when applied to a method?

Q. The smallest integer type is ......... and its size is ......... bits.

Q. The following program: public class Test{ static boolean isOK; public static void main(String args[]){ System.out.print(isOK); } }

Q. What will be the output of the following MySQL command? SELECT * FROM person WHERE emp_id IS NULL;

Q. How many of the following is (are) considered as a special character by 'mysql_real_escape_string()'? null byte, single quote, backslash

Q. Which of these values is not valid as an AUTO_INCREMENT value?

Q. If in Table "account", a column "cust_id" consists of {1,2,2,3,3,5,6,7,8,8} then what will be the output on executing the following MySQL statement? SELECT DISTINICT cust_id FROM account;

Q. What will be the output of the following SQL statement? SELECT person_id, fname, lname FROM person WHERE person_id=1;

Q. REGEXP does not take collation into account.

Q. What does a fully qualified table name consist of?

Q. To create a database only if it doesn't already exist, which clause is used?

Q. For the same input parameters, if the stored function returns the same result, it is called . . . . . . . .

Q. Which language is the core for APIs and communication in MySQL?

Q. The DECIMAL used for expressions containing only exact values with fractional part is of digit precision . . . . . . . .

Q. What is the datatype for single precision floating point number?

Q. The log that contains a record of server startups and shutdowns and the messages about exceptional conditions is . . . . . . . .

Q. Stored programs improve database security.

Q. The maximum size in bytes of a row in MySQL is . . . . . . . .

Q. The SQL mode to check for divide by zero error is . . . . . . . .

Q. Does the following MySQL statement belong to the "Inequality condition"? SELECT product_type.name, product.name FROM product_type INNER JOIN Product ON product_type.dept=Product.dept WHERE product_type.name<>’customers_accounts’;

Q. To convert a string to an int, the function is . . . . . . . .

Q. Which mode tells the server to recognize double quote as an identifier quoting character?

Q. Which of these is defined to execute when the table is modified only?

Q. The datatype for single precision floating point number is . . . . . . . .

Q. Consider a database name "db_name" whose attributes are intern_id (primary key), subject. Intern_id = {1, 2, 3, 4, 5, 6} Subject = {sql, oop, sql, oop, c, c++} If these are one to one relation then what will be the output of the following MySQL statement? SELECT intern_id FROM db_name WHER

Q. In the following SQL query, what does "person_id" stands for? CREATE TABLE person (person_ id SMALLINT UNSIGNED, fname VARCHAR(20), lname VARCHAR(20), CONSTRAINT pk_person PRIMARY KEY (person_id));

Q. The log in which data changes received from a replication master server are written is . . . . . . . .

Q. Which of the following table exist in Mysql?

Q. The ALL subquery performs which operation?

Q. When linking to a static MySQL C client library, the client library and the client application must use the same compiler option.

Q. To perform analysis of key values by the server, the statement used is . . . . . . . .

Q. Which is the header that should be included first?

Q. What is the significance of "ORDER BY emp_id ASC" in the following MySQL command? SELECT emp_id, fname, lname FROM person ORDER BY emp_id ASC;

Q. Loading is faster when a table has no indexes than when it is indexed.

Q. What will be the output of the following MySQL statement? SELECT emp_id, fname, lname FROM employee WHERE LEFT (fname, 1) =’F’;

Q. The function 'fetchrow_hashref()' returns reference to hash of row values keyed by . . . . . . . .

Q. In UNIX, the name of the option file is . . . . . . . .

Q. How many values can be returned from a stored procedure?

Q. CGI.pm does not support an object oriented style of use.

Q. What is the mantissa in -1.58E5?

Q. The numbers that are prefixed with '0x' are in base . . . . . . . .

Q. SELECT select_list FROM table_list WHERE row_constraint GROUP BY grouping_columns; Which of these is not optional?

Q. Which of these is a read only variable?

Q. Consider a database name "db_name" whose attributes are intern_id (primary key), subject. Intern_id= {1, 2, 3, 4, 5, 6} Subject= {sql, oop, sql, oop, c, c++} If these are one to one relation then what will be the output of the following MySQL statement? SELECT intern_id FROM db_name WHERE

Q. What is def in the following MySQL statement? DECLARE abc HANDLER FOR def ghi;

Q. Which program reads the statement from a binary log?

Q. What will be the storage pattern for "float(4,2)" in Mysql?

Q. The line that is not used to turn on the event scheduler is . . . . . . . .

Q. The IN, OUT and INOUT keywords do not apply to stored functions.

Q. Suppose run_me.sh is a script file. Which command is used to make it executable?

Q. Which command is used for taking "server side help" in Mysql command line tool?

Q. If you want to insert some slides from other presentation into current one choose

Q. Which of the following statement is true?

Q. In a table to insert User\'s Voice, Data field should be

Q. What is the purpose of NiFi's "Site-to-Site" protocol?

Q. What is the purpose of NiFi's "Remote Process Group"?

Q. How can you secure the communication between a Hadoop client and the ResourceManager?

Q. What is the purpose of Hadoop's HDFS Trash feature in a security context?

Q. How does Hadoop support encryption in transit for data transmitted between nodes in a cluster?

Q. Point out the correct statement.

Q. Spark was initially started by . . . . . . . . at UC Berkeley AMPLab in 2009.

Q. Spark is packaged with higher level libraries, including support for . . . . . . . . queries.

Q. Point out the correct statement.

Q. . . . . . . . . method is used to include a projection schema, to specify the output fields.

Q. What is the primary role of the HBase REST API in HBase?

Q. What is the purpose of the HBase Tiered Storage feature?

Q. What is the primary function of the HBase Load Balancer?

Q. What is the role of the HBase Region Locator in HBase architecture?

Q. In HBase, what is the purpose of the HBase Multi-Table feature?

Q. What is the significance of the Oozie Fork and Join nodes in a workflow?

Q. Which of the following are a collaborative data analytics and visualization tool?

Q. . . . . . . . . is a software distribution framework based on OSGi.

Q. Apache Knox accesses Hadoop Cluster over . . . . . . . .

Q. The easiest way to have an HDP cluster is to download the . . . . . . . .

Q. The items stored on . . . . . . . . are organized in a hierarchy of widget category.

Q. Point out the correct statement.

Q. . . . . . . . . forge software for the development of software projects.

Q. In Hive, what is the purpose of the DISTRIBUTE BY clause in a SELECT statement?

Q. Which of the following is a command line option?

Q. What is the primary function of the Hadoop RecordWriter?

Q. Thrift resolves possible conflicts through . . . . . . . . of the field.

Q. The . . . . . . . . as just the value field append(value) and the key is a LongWritable that contains the record number, count + 1.

Q. What is the significance of the FOREACH statement in Apache Pig?

Q. $ pig -x tez_local ... will enable . . . . . . . . mode in Pig.

Q. Which of the following is the default mode?

Q. Point out the correct statement.

Q. Which of the following has methods to deal with metadata?

Q. Which of the following script is used to check scripts that have failed jobs?

Q. What is the primary function of the Hadoop NodeManager in the YARN architecture?

Q. In Sqoop, what is the significance of the "--compression-codec" option in an import command?

Q. . . . . . . . . is used to decommission more than one RegionServer at a time by creating sub-znodes.

Q. BigDecimal is comprised of a . . . . . . . . with an integer 'scale' field.

Q. The Email & Apps team of . . . . . . . . uses ZooKeeper to coordinate sharding and responsibility changes in a distributed email client.

Q. The Mapper implementation processes one line at a time via . . . . . . . . method.

Q. The Pig Latin scripting language is not only a higher-level data flow language but also has operators similar to . . . . . . . .

Q. What does the term "InputFormat" represent in MapReduce?

Q. The output of the . . . . . . . . is not sorted in the Mapreduce framework for Hadoop.

Q. Which of the following class is provided by the Aggregate package?

Q. What does Hadoop MapReduce provide in terms of data processing?

Q. When a block is warm, some of its replicas are stored in DISK and the remaining replicas are stored in . . . . . . . .

Q. Which of the following method is used to get user-specified job name?

Q. . . . . . . . . is useful for iterating the properties when all deprecated properties for currently set properties need to be present.

Q. An input . . . . . . . . is a chunk of the input that is processed by a single map.

Q. . . . . . . . . class allows you to specify the InputFormat and Mapper to use on a per-path basis.

Q. . . . . . . . . method is used to reverse the values.

Q. What will be the value of num after the following Visual Basic code is executed?

Q. . . . . . . . . are operations that the object is capable of performing.

Q. . . . . . . . . can be used to advance the insertion point in a file or on the printer.

Q. Which of the following Case clauses is invalid in a Select Case statement whose selectorExpression is an Integer variable named intCode?

Q. . . . . . . . . refers to the process of locating and correcting errors.

Q. What will be in Msg after the following code is evaluated?

Q. The items in a combo box belong to which collection?

Q. Designers generally avoid using . . . . . . . . and . . . . . . . . in an interface.

Q. The procedure associated with the KeyPress event has . . . . . . . . parameters.

Q. A . . . . . . . . cannot change its value while the application is running.

Q. The text of many controls contain an underlined letter known as . . . . . . . .

Q. The . . . . . . . . is used to store controls that do not appear in the user interface during runtime.

Q. In vb . . . . . . . . is the extension to represent project file.

Q. The . . . . . . . . symbol is called the start /stop symbol in the flowchart.

Q. The list of items displayed by menu title are known as . . . . . . . .

Q. What value is stored in the count variable when the loop ends?

Q. . . . . . . . . property removes the title bar elements.

Q. In a . . . . . . . . loop the condition is evaluated before the instructions within the loop are processed.

Q. In . . . . . . . . if condition we can check more then one condition .

Q. What value is stored in the intCount variable when the loop ends?

Q. Object Browser are open from the . . . . . . . . or pressing the key F2. The left column of the Object Browser lists the objects and classes that are available in the projects

Q. What determines the Tab order?

Q. The code in an application can be broken into logical component by . . . . . . . . process

Q. The data type of the value assigned should be same as . . . . . . . .

Q. In Visual Basic, which of the following keyword tells the computer to pass the variable's address rather than its contents?

Q. The . . . . . . . . is a very useful control for Visual Basic, as it is not only used to provide instructions and guides to the users, it can also be used to display outputs.

Q. The . . . . . . . . include all widow property, form, project ,form layout .

Q. Writing data to a file is referred to as . . . . . . . .

Q. The . . . . . . . . in a two-dimensional array specifies the elements row and column position.

Q. What is the result of the expression 5 %% 2 in R?

Q. What does the next statement do in R?

Q. What is the mode of 'a' in the following R code? a <- c(1,” a”, FALSE)

Q. Which technology do we mix our business logic with the presentation logic?

Q. Which object of HttpSession can be used to view and manipulate information about a session?

Q. Which of these variables stores the number of hits that are successfully served out of cache?

Q. A JSP page consists of which tags?

Q. Which command is used to display the version of the Linux kernel?

Q. Which command is used to display the manual for a specific command?

Q. Which command is used to compress a file in 'tar' format?

Q. Which of the following commands is used to set the system's date and time in Linux?

Q. Which command is used to display information about the system's disk partitions?

Q. What does the 'ls -l' command do in Linux?

Q. Which command is used to monitor system performance in real-time?

Q. What does the 'grep' command do in Linux?

Q. Which Linux command is used to display system uptime?

Q. Which Linux command is used to shut down the system?

Q. Which command is used to change file permissions in Linux?

Q. Which command is used to display the current working directory?

Q. Which header file is required to use file handling in C++?

Q. What will be the output of the following code? int x = 5; cout << (x << 1);

Q. Which operator is used to get the address of a variable in C++?

Q. Which C++ feature allows a derived class to inherit members from a base class?

Q. What is the output of the following code snippet? int x = 10; int y = 20; cout << (x <= y ? x : y);

Q. What is the output of the following code snippet? int x = 10; int y = 20; cout << (x != y ? x : y);

Q. What will be the output of the following code? int a = 5; int b = 2; cout << a / b;

Q. Which of the following is the correct syntax to include a C++ library?

Q. Which of the following C++ keywords is used to declare a constant?

Q. Which of the following is the correct syntax to open a file in C++?

Q. Which of the following is the correct way to define a constructor with parameters in C++?

Q. What is the output of the following code snippet? int x = 10; int y = 20; cout << (x >= y);

Q. Which of the following is the correct way to define a class template in C++?

Q. What is the output of the following code snippet? int x = 10; int y = 20; cout << (!x);

Q. What is the output of the following code snippet? int x = 10; int y = 20; cout << (x >> 1);

Q. What is the output of the following code snippet? int x = 10; int y = 20; cout << (x * y);

Q. Which of the following is the correct way to define a virtual function in C++?

Q. Which of the following is the correct way to define a friend function in C++?

Q. What is the output of the following code snippet? int a = 10; int b = 20; cout << (a > b ? a : b);

Q. Which of the following is used to terminate a loop in C++?

Q. Which of the following is the correct way to define a constant pointer in C++?

Q. What is the purpose of the 'main' function in C++?

Q. Which of the following is the correct way to create a set in Python?

Q. Which method is used to add an element to the end of a list in Python?

Q. What does the 'docker commit' command do?

Q. What is the purpose of the 'docker-compose config --no-interpolate' command?

Q. Which command is used to view the Docker container's environment variables?

Q. Which of the following Docker commands is used to restart a container?

Q. Which of the following commands is used to remove all stopped containers?

Q. Which Docker command is used to update the Docker engine?

Q. Which command is used to start a container in the background?

Q. Which of the following commands will remove a Docker image?

Q. Which file is used by Docker Compose to configure and manage multi-container applications?

Q. Which command is used to view the Docker system-wide information?

Q. What is the purpose of the 'docker-compose config' command?

Q. Which command is used to remove a running container?

Q. What is the role of the Docker daemon?

Q. Which command is used to list all Docker volumes?

Q. Which Docker command is used to stop a container?

Q. What does the '--rm' flag do when running a Docker container?

Q. What is a Docker volume?

Q. Which command is used to pull an image from Docker Hub?

Q. Which command is used to build a Docker image from a Dockerfile?

Q. What is the purpose of the 'build' section in a Docker Compose file?

Q. What is the purpose of 'depends_on' in a Docker Compose file?

Q. What is the purpose of the SHELL instruction in a Dockerfile?

Q. What does the 'docker run' command do?

Q. A block comment can be written by

Q. Identify the valid integer from the following:

Q. OOPs follows ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ approach during program design.

Q. In OOP which cocept provides the idea of reusability.

Q. ‐‐‐‐‐‐ refers to the use of the same thing for different purpose.

Q. The qualifier ‐‐‐‐‐‐ tells the compiler that the function should not modify the argument.

Q. Which of the following is an exit controlled loop?

Q. What will be the values of x, m and n after the execution of the following statements? int x, m, n; m = 10; n = 15; x = ++m + n++;

Q. Which of the following statements are true in c++?

Q. Observe following function declaration and choose the best Ans:: int divide ( int a, int b = 2 )

Q. How many times is a do while loop guaranteed to loop?

Q. Find out the error in following block of code. If (x = 100) Cout << “x is 100”;

Q. Which one of the following is the correct operator to compare two values

Q. _________ used to make a copy of one class object from another class object of the same class type.

Q. Which of the following statement is correct?

Q. Which of the following statements is correct?

Q. Which of the following statements is incorrect?

Q. The function contain in the ios class to specify number of decimal places

Q. Which function is in the ostream class

Q. The class that derived from standard library ios contain output functions

Q. The memory management operator in c++

Q. The variable that contains the address of constant or variable

Q. The mechanism of giving special meaning to an operator

Q. To ensure that every object in the array receives a destructor call, always delete memory allocated as an array with operator __________ .

Q. If same message is passed to objects of several different classes and all of those can respond in a different way, what is this feature called?

Q. Which among the following best defines abstraction?

Q. In which tcp_wrappers file can you specify to allow all connections from all hosts?

Q. How do you direct the shell to execute a command in the background?

Q. What does the permission string rwxr-xr-- correspond with in octal?

Q. What is the following syntax used for? command >file1 2>file2

Q. How would you display running httpd processes?

Q. What command is used to assign executable permission to the owner of the file named "letter"?

Q. What command is used to print a file?

Q. What command is used to display the top of the file?

Q. Which character is used to match exactly one character?

Q. The head command writes the first ____________ lines of a file to screen by default.

Q. "cat" is the command used to

Q. Which is the commmand used to remove or delete file with out confirmation msg ?

Q. How would you lock the user account named csm099?

Q. The layout manager that lays out a container's components in a rectangular grid.

Q. What is different between a Java applet and a Java application?

Q. What is C Tokens?

Q. What is the output of the following program? dictionary1 = {'GFG' : 1, 'Google' : 2, 'GFG' : 3 } print(dictionary1['GFG']);

Q. What happens when delete is used for a NULL pointer? int *ptr = NULL; delete ptr;

Q. Predict the output? #include <iostream> using namespace std; class Test { int x; Test() { x = 5; } }; int main() { Test *t = new Test; cout << t->x; }

Q. Which of the following is true about new when compared with malloc: 1) new is an operator, malloc is a function 2) new calls constructor, malloc doesn’t 3) new returns appropriate pointer, malloc returns void * and pointer needs to typecast to appropriate type.

Q. In C++, const qualifier can be applied to 1) Member functions of a class 2) Function arguments 3) To a class data member which is declared as static 4) Reference variables

Q. Implicit return type of a class constructor is:

Q. Amazon Web Services (AWS) is an example of

Q. Virtualization assigns a logical name for a physical resource and then provides a pointer to that physical resource when a request is made

Q. One of the reasons of widespread of cloud is its ability to provide resource allocation dynamically from a pool of VM resources. State True or False.

Q. NASA created can be fifty percent more energy efficient as it turns off the computers on the network to make cloud computing efficient.

Q. In distributed systems, link and site failure is detected by

Q. enables the migration of the virtual image from one physical machine to another.

Q. as a utility is a dream that dates from the beginning of the computing industry itself.

Q. In intel’s IA-32 architecture there is a separate 16 bit address space for the I/O devices.

Q. For the model, the security boundary may be defined for the vendor to include the software framework and middleware layer.

Q. Which of the following storage devices exposes its storage to clients as Raw storage that can be partitioned to create volumes ?

Q. Types of Zigbee devices are available as follows: i. ZigBee Coordinator ii. ZigBee Router iii. ZigBee End Device iv. ZigBee Accessor

Q. AMIs are operating systems running on the virtualization hypervisor.

Q. is a virtual server platform that allows users to create and run virtual machines on Amazon’s server farm.

Q. Which of the following is commonly used to describe the service interface, how to bind information, and the nature of the component’s service or endpoint?

Q. Cloud computing is a system and it is necessarily unidirectional in nature.

Q. The is something that you can obtain under contract from your vendor.

Q. An application that needed storage alone might not benefit from a cloud deployment at all.

Q. How many categories of storage devices broadly exist in cloud?

Q. Which of the following system does not provision storage to most users?

Q. A service provider reselling a may have the option to offer one module to customize the information.

Q. An operating system running on a Type VM is full virtualization.

Q. Amazon ______ cloud-based storage system allows you to store data objects ranging in size from 1 byte up to 5GB.

Q. In a ____________ scheme, the VM is installed as a Type 1 Hypervisor directly onto the hardware.

Q. A virtual machine running on a server of a particular make cannot be relocated to b the server of another make.

Q. AMI(Amazon Machine Image) imaging service is provided by Amazon for ______________

Q. Amazon’s Elastic Compute Cloud (EC2) is a well known ______.

Q. The term ‘Cloud’ in cloud-computing refers to ______.