Home / Gopal Sharma / Programming MCQs Solution

Programming Portal Solution

You will find all Programming Portal MCQs whose solution is updated by Gopal Sharma

Q. In Java, can a "catch" block catch exceptions of a subclass type before catching exceptions of a superclass type?

Q. What is the result of the following code snippet? try { throw new NullPointerException(); } catch (ArithmeticException e) { System.out.println("Arithmetic Exception!"); } catch (NullPointerException e) { System.out.println("NullPointerException!"); }

Q. In Java, can a "catch" block catch exceptions of a superclass type?

Q. What is the purpose of the "finally" block in Java exception handling?

Q. What is method overriding in Java?

Q. What will be the output? class Parent{ public void method(){ System.out.println("Hi i am parent"); } } public class Child extends Parent{ protected void method(){ System.out.println("Hi i am Child"); } public static void main(

Q. What will be the output of the following Java code? class A { int i; int j; A() { i = 1; j = 2; } } class Output { public static void main(String args[]) { A obj1 = new A(); System.out.print(obj1.toString()); } }

Q. What will be the output of the following Java program? public class BoxDemo { public static <U> void addBox(U u, java.util.List<Box<U>> boxes) { Box<U> box = new Box<>(); box.set(u); boxes.add(box); } public static <U> void out

Q. Which of these packages contain classes and interfaces used for input & output operations of a program?

Q. Which of these type parameters is used for a generic class to return and accept a number?

Q. What will be the output of the following Java program? class X { int a; double b; } class Y extends X { int c; } class Output { public static void main(String args[]) { X a = new X(); Y b = new Y(); Class obj; obj = b.getClass(); System.out

Q. What is the result of the following code snippet? abstract class MyAbstract { static void myMethod() { System.out.println("Static Method"); } } class MyClass extends MyAbstract { public static void main(String[] args) { MyAbstract.myMethod(); } }

Q. In Java, can an abstract class have static methods with implementations?

Q. What happens if the following program is compiled and executed? interface MyInterface{ void display(); } interface MySubInterface extends MyInterface{ void display(); } public class Test implements MySubInterface{ public void display(){ System.out.print("Welcome

Q. What will be the output of the following Java code? class Output { public static void main(String args[]) { byte a[] = { 65, 66, 67, 68, 69, 70 }; byte b[] = { 71, 72, 73, 74, 75, 76 }; System.arraycopy(a , 0, b, 0, a.length); System.out.print(new String(a

Q. Which of these exceptions will be thrown if we declare an array with negative size?

Q. Which of these methods calls update() method?

Q. Which method is called during method overriding in Java if the superclass method is invoked using the "super" keyword?

Q. What is the process of defining two or more methods within same class that have same name but different parameters declaration?

Q. What is true about constructor?

Q. What will be the result of compiling and running the given code? class A{ int b=10; private A(){ this.b=7; } int f(){ return b; } } class B extends A{ int b; } public class Test{ public static void main(String[] args){ A a

Q. What is the extension of compiled java classes?

Q. Which of the below is not a memory leak solution?

Q. What will be the output of the following Java program? class recursion { int fact(int n) { int result; if (n == 1) return 1; result = fact(n - 1) * n; return result; } } class Output { public static void main(String args[]) {

Q. What happens to the thread when garbage collection kicks off?

Q. What is the extension of java code files?

Q. How to get prints of shared object memory maps or heap memory maps for a given process?

Q. Which operator is used for logical NOT in Java?

Q. What is the result of the expression true && false in Java?

Q. What is the value of the expression true || false in Java?

Q. Which operator is used to perform bitwise XOR in Java?

Q. What will be the output of the following Java code?

Q. What is true about do statement?

Q. Which of these statements are incorrect?

Q. Which of these is returned by "greater than", "less than" and "equal to" operators?

Q. In Java, which operator is used to concatenate two strings?

Q. Which of the following is true about string concatenation in Java?

Q. How many Constructor String class have?

Q. Which of these constructors is used to create an empty String object?

Q. Which of the following methods is used to replace all occurrences of a specified character in a string in Java?

Q. What will be the output of the following Java program? class output { public static void main(String args[]) { StringBuffer c = new StringBuffer("Hello"); StringBuffer c1 = new StringBuffer(" World"); c.append(c1); System.out.println(

Q. How do you access an element in a one-dimensional array named myArray at index 3 in Java?

Q. What is the correct way to initialize a two-dimensional array in Java?

Q. In Java, how do you remove an element at a specific index from an ArrayList named list?

Q. How do you find the number of rows in a two-dimensional array named matrix in Java?

Q. How do you declare a multi-dimensional array in Java?

Q. What will be the output of the following Java code? class array_output { public static void main(String args[]) { int array_variable [] = new int[10]; for (int i = 0; i < 10; ++i) { array_variable[i] = i; System.out.print(array_variable[i] + &q

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

Q. What keyword is used to declare a variable that can be accessed without creating an instance of the class?

Q. What can directly access and change the value of the variable qusNo? package com.mypackage; public class Test{ private int qusNo = 100; }

Q. What is the maximum value that can be stored in a byte variable in Java?

Q. Which keyword is used to declare a variable that can hold a reference to an object of any class in Java?

Q. Which data type is used to store numbers with decimal points and less precision than double?

Q. What will the output of the following program? public class Test{ public static void main(String args[]){ float f = (1 / 4) * 10; int i = Math.round(f); System.out.println(i); } }

Q. What would be the output of the following fraction of code? int Integer = 34 ; char String = 'S' ; System.out.print( Integer ) ; System.out.print( String ) ;

Q. What will be the output of the following Java code snippet? public class AddDemo { public static void main(String args[]) { BigDecimal b = new BigDecimal("23.43"); BigDecimal br = new BigDecimal("24"); BigDecimal bres = b.add(new BigDecimal("450.23"));

Q. The MySQL server is not configurable.

Q. The option that executes all SQL statements in a SQL script irrespective of the number of errors is . . . . . . . .

Q. Which of these is a stored program associated with a schedule?

Q. Which is the command to move the cursor to the beginning of line in mysql input editor?

Q. What is joining a table to itself called?

Q. The maximum number of indexes on MyISAM table is . . . . . . . .

Q. The -protocol value 'TCP' runs on which operating systems?

Q. Which clause is used to "group rows together by common columns values"?

Q. Which variable is a handle to a database object?

Q. The query 'SELECT NOW()' shows the current . . . . . . . .

Q. What is the default format for "Time" data type?

Q. How many storage engines among the following are transaction-safe? InnoDB, Falcon, MyISAM, MEMORY

Q. If an integer column is used for the values in range 1 to 99999, the best suitable datatype is . . . . . . . .

Q. Which clause is similar to "HAVING" clause in Mysql?

Q. The MySQL server used in its client/server architecture is . . . . . . . .

Q. The slow query log is written as . . . . . . . .

Q. The option in mysqlshow to show information about indexes in a table is . . . . . . . .

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

Q. Find the error in the following SQL statement? CREATE TABLE person ( person_id SMALLINT, name VARCHAR, LAST VARCHAR CONSTRAINTS pk_person PRIMARY KEY (person_id)); INSERT INTO person VALUES( person_id, name, LAST) (1, ’s’, ’p’); INSERT INTO person ( person_id, nam

Q. What is the meaning of "SELECT" clause in Mysql?

Q. Views are not updatable.

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

Q. Which data directory subdirectory corresponds to the nbdinfo database?

Q. What is generally done after the transactions are executed successfully?

Q. The generic handle whose meaning depends on context is . . . . . . . .

Q. The creation of a stored program is similar to the definition of a . . . . . . . .

Q. A BIT value in a result set is displayed as a binary string.

Q. In PHP, if $a represents an array with numeric indices, how is the first element accessed?

Q. The following MySQL statement belongs to which condition types? SELECT fname FROM person WHERE fed_id=’111-11-111’;

Q. What is the need of "column Aliases" in "SELECT" clause?

Q. MySQL uses security based on ACL. What does it stand for?

Q. With only MyISAM tables, how many of the following are for use? mysql, mysqladmin, mysqldump, mysqlisamchk

Q. Prior to MySQL 6.0, utf8 was . . . . . . . .

Q. The disk data that the FILES table in INFORMATION_SCHEMA stores is . . . . . . . .

Q. Which of these take more space? Variable length columns, Fixed length columns

Q. The largest value to which the variable 'max_allowed_packet' can be set is . . . . . . . .

Q. Arrays can have associative indices in PHP.

Q. MySQL does not automatically convert a date or time value to a number if the value is used in a numeric context.

Q. How is the output from PHP generated?

Q. The left and right joins are also known as . . . . . . . .

Q. Which of the following statement is true

Q. What's the best place to find animated images for your PowerPoint 2002 presentation?

Q. Microsoft Project is

Q. What is an index?

Q. What is the role of the "QueryRecord" processor in Apache NiFi?

Q. What is the role of the "ConvertRecord" processor in NiFi's data flow?

Q. In NiFi, what is the primary function of the "PutMongoRecord" processor?

Q. What is the role of the Hadoop Security Manager in a Hadoop cluster?

Q. What role does the Hadoop CredentialProvider API play in securing Hadoop credentials?

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

Q. . . . . . . . . generates NGrams and counts frequencies for ngrams, head and tail subgrams.

Q. . . . . . . . . can be used to generate stats over the results of arbitrary numeric functions.

Q. Flume deploys as one or more agents, each contained within its own instance of . . . . . . . .

Q. The tokens are passed through a Lucene . . . . . . . . to produce NGrams of the desired length.

Q. SolrJ now has first class support for . . . . . . . . API.

Q. Hive version . . . . . . . . is the first release that includes HCatalog.

Q. Spark architecture is . . . . . . . . times as fast as Hadoop disk-based Apache Mahout and even scales better than Vowpal Wabbit.

Q. . . . . . . . . uses blocking socket I/O for transport.

Q. Inline DoFn that splits a line up into words is an inner class . . . . . . . .

Q. Heap usage during IndexWriter merging is also much lower with the new . . . . . . . .

Q. . . . . . . . . is the type supported for storing values in HCatalog tables.

Q. . . . . . . . . executes the pipeline as a series of MapReduce jobs.

Q. What is an Oozie Bundle in the context of workflow automation?

Q. In Oozie, what is the primary function of the Oozie Bundle Application Coordinator?

Q. A . . . . . . . . can route requests to multiple Knox instances.

Q. . . . . . . . . is a toolkit/application for converting between and editing common office file formats.

Q. Ripple is a browser based mobile phone emulator designed to aid in the development of . . . . . . . . based mobile applications.

Q. . . . . . . . . runs Demux parsers inside for convert unstructured data to semi-structured data, then load the key value pairs to HBase table.

Q. Apache . . . . . . . . is a platform for building native mobile applications using HTML, CSS and JavaScript (formerly Phonegap).

Q. In Hive, what is the role of the INDEX clause in a CREATE TABLE statement?

Q. What is the role of the Hive Hadoop Compatibility feature?

Q. In Hadoop, what does the term "Serialization" refer to?

Q. In Hadoop MapReduce, what is the role of the LazyOutputFormat?

Q. The . . . . . . . . codec from Google provides modest compression ratios.

Q. Which of the following is a primitive data type in Avro?

Q. You can run Pig in interactive mode using the . . . . . . . . shell.

Q. PigUnit runs in Pig's . . . . . . . . mode by default.

Q. Point out the wrong statement.

Q. Which of the following script determines the number of scripts run by user and queue on a cluster?

Q. In Hadoop, what is the role of the Hadoop ResourceManager in the YARN architecture?

Q. What is the role of the Sqoop "--incremental" option in an import command?

Q. The ZooKeeper Data Directory contains files which are . . . . . . . . copy of the znodes stored by a particular serving ensemble.

Q. Point out the wrong statement.

Q. Data can be imported in maximum . . . . . . . . file formats.

Q. How many types of special znodes are present in Zookeeper?

Q. . . . . . . . . has a design policy of using ZooKeeper only for transient data.

Q. For each SSTable, Cassandra creates . . . . . . . . index.

Q. What is the primary function of the Hadoop Reducer.Context in a MapReduce application?

Q. In a MapReduce job, what is the function of the Hadoop TaskAttemptContext?

Q. Point out the correct statement.

Q. . . . . . . . . is the primary interface by which user-job interacts with the JobTracker.

Q. What does HDFS stand for in the context of Hadoop?

Q. Above the file systems comes the . . . . . . . . engine, which consists of one Job Tracker, to which client applications submit MapReduce jobs.

Q. As companies move past the experimental phase with Hadoop, many cite the need for additional capabilities, including . . . . . . . .

Q. . . . . . . . . is a platform for constructing data flows for extract, transform, and load (ETL) processing and analysis of large datasets.

Q. Which phase in MapReduce is responsible for reading input data?

Q. What does the MapReduce "Reducer" function do?

Q. Point out the wrong statement.

Q. Point out the correct statement.

Q. Which Apache project is used for workflow automation in Hadoop?

Q. Which Apache project in Hadoop is designed for real-time data streaming?

Q. What is the purpose of the Hadoop Distributed File System (HDFS) in the architecture?

Q. Which component of Hadoop is responsible for storing and managing data blocks?

Q. What is the function of the Hadoop InputSplit in MapReduce?

Q. In advanced MapReduce, what is the significance of the Hadoop MapReduce "Map-side Join"?

Q. What is the primary purpose of the Hadoop MapReduce "In-Mapper Combining" technique?

Q. What is the primary function of the Hadoop MapReduce "Map-side Join" technique?

Q. . . . . . . . . storage is a solution to decouple growing storage capacity from compute capacity.

Q. Data transfer between Web-console and clients are protected by using . . . . . . . .

Q. . . . . . . . . is another implementation of the MapRunnable interface that runs mappers concurrently in a configurable number of threads.

Q. Which of the following is used to list out the storage policies?

Q. . . . . . . . . is the base class for all implementations of InputFormat that use files as their data source.

Q. Point out the wrong statement.

Q. The . . . . . . . . is responsible for allocating resources to the various running applications subject to familiar constraints of capacities, queues etc.

Q. YARN's dynamic allocation of cluster resources improves utilization over more static . . . . . . . . rules used in early versions of Hadoop.

Q. The CapacityScheduler has a predefined queue called . . . . . . . .

Q. Which of the following is the only way of running mappers?

Q. . . . . . . . . initializes a new instance of Line class.

Q. A control's border is determined by . . . . . . . . property.

Q. code in vb is stored in the form of . . . . . . . .

Q. What is the result of the expression 10-2+20 ><2*25-2?

Q. A class . . . . . . . . all the behavior and attributes of an object.

Q. The convention is to use . . . . . . . . case for classname.

Q. Which of the following property is used to specify a combo box's style in Visual Basic?

Q. The. . . . . . . . control lets the user selects or unselects an option we can select more than one option from the group.

Q. Unary and Binary refer to the number of . . . . . . . . needed by the operator.

Q. The number of characters contained in a String is stored as Integer in String's . . . . . . . .

Q. In . . . . . . . . , The size of the array can be changed at the run timesize changes during the program execution.

Q. A . . . . . . . . is a special computer that serves webpages.

Q. . . . . . . . . method is used for accessing any number of characters in a String.

Q. in VB, . . . . . . . . is called integrated because we can access virtually all of the development tools

Q. Designers at times use colour as the means of . . . . . . . . a user interface.

Q. The main Property of picture box is . . . . . . . .

Q. The strItems array is declared as follows: Dim strItems(20) As String. The intSub variable keeps track of the array subscripts and is initialized to 0. Which of the following Do clauses will process the loop instructions for each element in the array?

Q. . . . . . . . . in the Tool Box is used to add a button control to a form.

Q. MS-access or oracle is the example of . . . . . . . . software.

Q. An object is the . . . . . . . . of the class.

Q. A variable can store . . . . . . . . value at a time.

Q. What will be the content of Text after the code is executed with id=8? If id==1 Then Text="Janet"; Elseif id==2 OrElse id==3 Then Text="Mark" ElseIF id==4 Then Text="Jerry" Else Text="Sue "; EndIf

Q. What happens when both the minimize box and maximize box property are set to false in Visual Basic?

Q. A procedure-level variable is declared using . . . . . . . . keyword.

Q. StretchImage Property is present in which dialog box?

Q. What happens when maximize box is set to true?

Q. What output will be returned if the following Visual Basic code is executed?

Q. What will be assigned to the dblAvg variable after the code has been executed? The intTotal, intSub, and dblAvg variables contain the number 0 before the loops are processed.

Q. How is a data frame created in R?

Q. How can we define 'infinity' in R language?

Q. Which is not a directive?

Q. JavaServer Pages often serve the same purpose as programs implemented using the Common Gateway Interface (CGI)

Q. SessionFactory is a thread-safe object.

Q. Which of the scripting of JSP not putting content into service method of the converted servlet?

Q. Which Linux command can be used to check the status of a service?

Q. Which command is used to find out the current version of the Linux kernel?

Q. Which command is used to show the current user's login name?

Q. Which command is used to change the password of a user in Linux?

Q. Which function is used to release dynamically allocated memory in C++?

Q. Which C++ feature allows different functions to have the same name but different parameters?

Q. Which operator is used to access the member of a namespace?

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

Q. Which of the following is true about multiple inheritance in C++?

Q. Which of the following statements about recursion in C++ is true?

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

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

Q. Which of the following is the correct way to call a member function of a class in C++?

Q. What is the purpose of the 'static' keyword in C++?

Q. Which of the following is true about destructors in C++?

Q. Which of the following is the correct syntax to declare a static variable in C++?

Q. Which of the following C++ data types is used to store a single character?

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

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 copy assignment operator in C++?

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

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 *ptr = &x; cout << *ptr;

Q. What is the output of the following code snippet? int x = 5; int y = x++; cout << y;

Q. What is the default access specifier for class members in C++?

Q. Which of the following is the correct syntax for a constructor in C++?

Q. Which of the following is used to handle exceptions in C++?

Q. How do you declare a variable in Python?

Q. Which of the following data types is mutable in Python?

Q. What is the correct way to import the math module in Python?

Q. Which of the following is the correct syntax for defining a function in Python?

Q. What does the 'docker exec -it container_name /bin/sh' command do?

Q. Which of the following options is correct regarding Docker layers?

Q. Which of the following is used to give a container access to a specific port?

Q. Which command is used to view the Docker container's restart policy?

Q. Which command is used to view the Docker container's port mappings?

Q. Which command is used to view the Docker build history of an image?

Q. Which of the following is a valid Docker Compose file version?

Q. Which of the following is the correct way to expose a Docker container’s port to the host?

Q. Which of the following command removes all unused images, containers, and networks?

Q. What is the role of Docker's 'CMD' instruction in a Dockerfile?

Q. Which of the following is a valid Docker command to list all stopped containers?

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

Q. Which of the following Docker commands is used to remove all unused data (containers, networks, images)?

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

Q. Which of the following commands is used to pull a Docker image from Docker Hub?

Q. Which of the following Docker commands is used to remove a specific image?

Q. Which Docker command is used to show running containers?

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

Q. What is the purpose of the 'docker stats' command?

Q. What is the purpose of the 'docker inspect' command?

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

Q. Which command is used to view logs of a Docker container?

Q. Which of the following commands is used to rebuild an image in Docker?

Q. Which Docker command is used to create a new Docker network?

Q. Which command is used to tag a Docker image?

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

Q. How can you stop a running Docker container?

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

Q. How can you set Docker Compose to automatically remove containers after they stop?

Q. What does the 'docker-compose build' command do?

Q. Which command is used to list all running services in Docker Compose?

Q. Which file format does Docker Compose use?

Q. What is Docker Compose used for?

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

Q. Which command is used to start a stopped Docker container?

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

Q. Which command is used to remove a Docker image?

Q. What is Docker?

Q. We declare a function with ______ if it does not have any return type

Q. ‐‐‐‐‐ refer to the names of variables, functions, arrays, classes, etc.

Q. ‐‐‐‐‐‐ are the smallest or the atomic elements of a language.

Q. ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ relationship indicates that the change to an independent thing will affect the dependent thing.

Q. A ‐‐‐‐‐‐‐‐ is a physical device that exists at run time.

Q. Through ‐‐‐‐‐‐‐‐ we can eliminate redundant code and extend the use of existing class.

Q. The wrapping up of data and functions into a single unit is called ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐.

Q. The main function having argument

Q. The same function name having different tasks

Q. The functions declared inside the class is known as ‐‐‐‐‐‐‐‐

Q. To increase the value of c by one which of the following statement is wrong?

Q. Which of the following gets called when an object goes out of scope?

Q. Which of the following is the only technical difference between structures and classes in C++?

Q. Which of the following keywords is used to control access to a class member?

Q. Which of the following access specifies is used in a class definition by default?

Q. How can we make a class abstract?

Q. Which of the following statement is correct regarding destructor of base class?

Q. Which feature in OOP allows reusing code?

Q. What is the other name used for functions inside a

Q. Which operator is used with cout?

Q. Which file is the list of commands you recently entered stored in?

Q. What does the 2>&1 at the end of the following command mean?find / -name fred.txt > names 2>&1

Q. What command is used to list the jobs currently in print queues?

Q. What command is used to sort the lines of data in a file in reverse order?

Q. You need to change some settings on your Apache server. Which is the best tool to use for logging in remotely?

Q. ........command is used to show the logger or user

Q. How would you switch to virtual terminal 1?

Q. Which package consist an applet class? a) jav

Q. Which of these packages contains all the classes and methods required for event handling in Java? a) jav

Q. Which of the following statements correctly describes an interface?

Q. Which of the following is true about virtual functions in C++?

Q. When the inheritance is private, the private methods in base class are __________ in the derived class (in C++).

Q. Which of the following operators are overloaded by default by the compiler in every user defined classes even if user has not written? 1) Comparison Operator (==) 2) Assignment Operator (=)

Q. Which of the followings is/are automatically added to every class, if we do not write our own?

Q. When a virtual function is redefined by the derived class, it is called___________.

Q. Assigning one or more function body to the same name is called ____________.

Q. Which type of data file is analogous to an audio cassette tape?

Q. Choose the operator which cannot be overloaded.

Q. websocket is a Protocol

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

Q. Storage classes available with Amazon s3 are -

Q. The process wherein the processor constantly checks the status flags is called as

Q. When you publish a message is automatically created?

Q. . Which of the following allows you to create instances of the MySQL database to support your Web sites?

Q. Which among the following is the duties of the Data Nodes

Q. Which of the following is the correct statement?

Q. What is HDFS?

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

Q. is an embedded system which meshes the computing process with the physical world in the form of an interactive as well as intelligent system

Q. A mashup cloud can be designed by utilizing the Scalability of AWS and of GAE platforms

Q. To publish a REST service with Spring.

Q. Which of the following offers Storage size of 10GB free t0 100 GB paid?

Q. When you add a software stack, such as an operating system and applications to the service, the model shifts to model.

Q. Which of the following google product sends you periodic email alerts based on your search term?

Q. Which type of Hypervisor is shown in the following figure?

Q. Which of the following type of virtualization is found in hypervisor such as Microsoft’s Hyper-V ?

Q. The technology used to distribute service requests to resources is referred to as _____________

Q. What is the name of the organization helping to foster security standards for cloud computing?

Q. Which CSS property defines the radius of an element's corners?