Home / Ranjeet / Programming MCQs Solution

Programming Portal Solution

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

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

Q. Which of these class is related to all the exceptions that cannot be caught?

Q. What will be the output of the following Java code? class Output { public static void main(String args[]) { try { int a = 0; int b = 5; int c = b / a; System.out.print("Hello"); } } }

Q. Which of these methods return localized description of an exception?

Q. Which of these keywords is used to generate an exception explicitly?

Q. What is the result of the following code snippet? try { String str = null; System.out.println(str.length()); } catch (NullPointerException e) { System.out.println("NullPointerException!"); } catch (Exception e) { System.out.println("Exception!"); }

Q. What is the result of the following code snippet? try { int num = 10 / 0; } catch (ArithmeticException e) { System.out.println("Arithmetic Exception!"); } catch (Exception e) { System.out.println("Exception!"); }

Q. Determine output: class A{ public void method1(){ System.out.print("Class A method1"); } } class B extends A{ public void method2(){ System.out.print("Class B method2"); } } class C extends B{ public void method2(){ System.out.print("Class C method2"); } p

Q. How to read a classpath file?

Q. Which of these classes encapsulate runtime state of an object?

Q. How many bits are used for generating random numbers?

Q. What will be the output for the below code? public interface TestInf{ int i =10; } public class Test{ public static void main(String... args){ TestInf.i=12; System.out.println(TestInf.i); } }

Q. Runnable is a _____ .

Q. Which of these class is used to read characters in a file?

Q. Which of these methods is used to know whether a given Character object is part of Java's Identifiers?

Q. What will be the output of the following Java code? class Output { public static void main(String args[]) { double x = 3.14; int y = (int) Math.abs(x); System.out.print(y); } }

Q. What is the value of "d" in the following Java code snippet? double d = Math.round ( 2.5 + Math.random() );

Q. What is the return type of Math.random() method?

Q. How to assign values to variable using property?

Q. What is the result of the following code snippet? class Parent { void display() { System.out.println("Parent"); } } class Child extends Parent { void display() { System.out.println("Child"); } } public class Main { public static void main(String[] args) { Parent obj = new Child(

Q. What happens when a subclass tries to override a final method from the superclass in Java?

Q. what is the result of the following piece of code: public class Person{ public void talk(){ System.out.print("I am a Person"); } } public class Student extends Person{ public void talk(){ System.out.print("I am a Student");

Q. What is the output for the below code? class A{ private void printName(){ System.out.println("Value-A"); } } class B extends A{ public void printName(){ System.out.println("Name-B"); } } public class Test{ public static void m

Q. In Java, which method is automatically called when an object is created?

Q. Which keyword is used to define a method in Java?

Q. Which of the following options is the best for generating random integer 0 or 1?

Q. What would be the behaviour if this() and super() used in a method?

Q. What is the result of the expression 5 | 3 in Java?

Q. What is the result of the expression 8 / 4 in Java?

Q. On applying Left shift operator, <<, on integer bits are lost one they are shifted past which position bit?

Q. Which of these operators can skip evaluating right hand operand?

Q. The while loop repeats a set of code while the condition is not met?

Q. Which of these class is superclass of String and StringBuffer class?

Q. What will be the output of the following Java code? class output { public static void main(String args[]) { String c = "Hello i love java"; int start = 2; int end = 9; char s[]=new char[end-start]; c.getChars(start,end,s,0); System.out.pr

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

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

Q. In Java, what does the concat() method of a String object do?

Q. What is the value returned by function compareTo() if the invoking string is greater than the string compared?

Q. What does the length attribute of an array in Java represent?

Q. Which of the following is true about the size of an ArrayList in Java?

Q. How do you declare and initialize an array of integers with 5 elements in Java?

Q. In Java, what is the purpose of the Arrays.equals() method?

Q. What is the value of a[1] after the following code is executed? int[] a = {0, 2, 4, 1, 3}; for(int i = 0; i < a.length; i++) a[i] = a[(a[i] + 3) % a.length];

Q. Which of the following access modifiers restricts a method or variable's access to the same package only?

Q. You have the following code in a file called Test.java class Base{ public static void main(String[] args){ System.out.println("Hello"); } } public class Test extends Base{} What will happen if you try to compile and run this?

Q. What is the default value of an int variable in Java if it's not explicitly initialized?

Q. What is the keyword used to declare a constant value in Java?

Q. In Java, which data type is used to store numbers with decimal points?

Q. What is the size of a float variable in Java?

Q. Which of the following is the correct way to declare a boolean variable named isJavaFun and initialize it to true in Java?

Q. In Java, the word true is ................

Q. What will be the output of the following Java code snippet? enum Levels { private TOP, public MEDIUM, protected BOTTOM; }

Q. Which one is a valid declaration of a boolean?

Q. Stored programs refer to stored objects of how many of the following types? functions, procedures, triggers, events

Q. Which mode prevents MySQL to perform full checking of date parts?

Q. The statement that is used to check the status of the event scheduler at runtime is . . . . . . . .

Q. The data rows of a MyISAM table are stored in . . . . . . . .

Q. What will be the result of the following MySQL command? SELECT emp_id, ‘ACTIVE’ STATUS, emp_id * 3.14 emp_pi, UPPER (lname) last_name FROM employee;

Q. The security context when a user creates a stored program that accesses sensitive data but forgets that other people who can invoke the object have the same access is . . . . . . . .

Q. Which of the following belongs to an "aggregate function"?

Q. Which command is used to display all the existing tables in a database?

Q. Which among the following is an optional Keyword?

Q. What is generally used as a synonym for CHARACTER SET?

Q. How many options can be used to control LOCAL capability at runtime?

Q. The clause that enables mapping a short command to a long command is . . . . . . . .

Q. The statement that performs key distribution analysis and stores the distribution for the named tables is . . . . . . . .

Q. How many files does each end of a client/server connection including SSL support use to set up secure communications?

Q. Which procedure parameter enables the caller to pass in a value and get back a value?

Q. INFORMATION_SCHEMA is more portable than SHOW statements.

Q. The MySQL server is highly configurable.

Q. Is there any error in executing the following MySQL command? SELECT emp_id, ‘ACTIVE’, emp_id * 3.145, UPPER (lname) FROM Employee;

Q. Which function returns NULL if expr1 = expr2?

Q. When linking to a static MySQL C client library, the client library and the client application can use different compiler options.

Q. If emp_id contain the following set {1, 2, 2, 3, 3, 1}, what will be the output on execution of the following MySQL statement? SELECT emp_id FROM person ORDER BY emp_id;

Q. What represents an 'attribute' in a relational database?

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

Q. mysql_next_result() returns a status.

Q. Triggers and events are not invoked automatically by the server.

Q. What enables encrypted connections to be established?

Q. Which statement is used to see the definition for an existing database?

Q. The log enabled by -relay-log-index is . . . . . . . .

Q. Which Key is used to link two tables in Mysql?

Q. The default path to perl in Unix is . . . . . . . .

Q. The PHP interpreter switches mode continuously.

Q. Case sensitivity in SQL statements does not vary for different operating systems of the machine on which the server is running.

Q. Numbers prefixed with '0x' are in base . . . . . . . .

Q. What is the default value of column?

Q. What is 'xyz' in the following SQL statement? SELECT xyz FROM table1 UNION xyz FROM table2;

Q. The columns containing binary value that include null bytes will not print properly using the %s printf() format specifier.

Q. How can the value of recently generated sequence number be obtained?

Q. A password applies locally to an account.

Q. What is the command to disable autocommit and launch a transaction?

Q. Which Clause is used to sort the stored data in alphabetical order?

Q. In MySQL, the default size of the key buffer in MB is . . . . . . . .

Q. The binary protocol is more difficult to use.

Q. The default storage engine used is . . . . . . . .

Q. Suppose the last row has the AUTO_INCREMENT column value 32. Suppose a new row is added by setting AUTO_INCREMENT value equal to 100. The next row added will have value . . . . . . . .

Q. Which myisamchk variable represents the size of buffer used to hold index blocks?

Q. Anonymous accounts have user name . . . . . . . .

Q. The table that lists the column level privileges is . . . . . . . .

Q. The statement to remove indexes on tables is . . . . . . . .

Q. Which of the following is not one of PowerPoint's views?

Q. In Microsoft Word shortcut key CTRL+B is used for

Q. Which do you click to display the table\'s primary key and indexes in a separate window?

Q. What does the term "Load Balancer" mean in the context of NiFi clusters?

Q. In NiFi, what does the term "FlowFile Repository" refer to?

Q. How can you configure Hadoop to use LDAP for user authentication?

Q. What is the purpose of Hadoop's HDFS Encryption Zone?

Q. What is the primary purpose of Hadoop's Kerberos authentication?

Q. What is the role of Hadoop's HDFS snapshot feature in terms of security?

Q. How can you secure Hadoop's JobHistory Server?

Q. How can you secure the communication between nodes in a Hadoop cluster using SASL?

Q. How does Hadoop support authentication and authorization in HDFS?

Q. What is the purpose of Hadoop's HDFS Snapshot in the context of security?

Q. . . . . . . . . accepts a table to read data from and optionally a selection predicate to indicate which partitions to scan.

Q. Drill integrates with BI tools using a standard . . . . . . . . connector.

Q. Point out the wrong statement.

Q. HCatalog supports reading and writing files in any format for which a . . . . . . . . can be written.

Q. . . . . . . . . is a Python port of the Core project.

Q. A . . . . . . . . is used to manage the efficient barrier synchronization of the BSPPeers.

Q. Point out the correct statement.

Q. For . . . . . . . . partitioning jobs, simply specifying a custom directory is not good enough.

Q. In HBase, what does the term "MemStore" refer to?

Q. What is the significance of the HBase Region Split in HBase?

Q. What is the role of the HBase Coprocessor Observer in HBase?

Q. What is the purpose of the Oozie Sharelib in workflow automation?

Q. What is the purpose of the Oozie Sharelib Create tool?

Q. Point out the correct statement.

Q. Point out the wrong statement.

Q. Point out the correct statement.

Q. Chukwa is . . . . . . . . data collection system for managing large distributed systems.

Q. . . . . . . . . provides an intuitive, easy-to-use Hadoop management web UI backed by its RESTful APIs.

Q. In Hive, what does the term "Bucketing" refer to?

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

Q. In Hive, what is the role of the LIMIT clause in a SELECT statement?

Q. What is the primary role of the Hive ORC (Optimized Row Columnar) file format?

Q. Integral literals are assumed to be . . . . . . . . by default.

Q. Point out the correct statement.

Q. The AvroSerde has been built and tested against Hive 0.9.1 and later, and uses Avro . . . . . . . . as of Hive 0.13 and 0.14.

Q. HBase is a distributed . . . . . . . . database built on top of the Hadoop file system.

Q. The . . . . . . . . is an iterator which reads through the file and returns objects using the next() method.

Q. How many formats of SequenceFile are present in Hadoop I/O?

Q. The LZO compression format is composed of approximately . . . . . . . . blocks of compressed data.

Q. The . . . . . . . . and the EditLog are central data structures of HDFS.

Q. In Pig, what is the purpose of the Pig Latin SAMPLE statement?

Q. You can run Pig in batch mode using . . . . . . . .

Q. Which of the following is correct syntax for parameter substitution using cmd?

Q. Which of the following file contains user defined functions (UDFs)?

Q. In Hadoop, what is the purpose of the Hadoop ResourceManager "Blacklisting" feature in a Hadoop cluster?

Q. NameNode is monitored and upgraded in a . . . . . . . . transition.

Q. What is the purpose of Flume Agents in the Flume architecture?

Q. In Sqoop, what is the significance of the "--as-parquetfile" option in an export command?

Q. What is the purpose of the Sqoop "--query" option in an import command?

Q. When . . . . . . . . contents exceed a configurable threshold, the memtable data, which includes indexes, is put in a queue to be flushed to disk.

Q. Internal authentication stores usernames and bcrypt-hashed passwords in the . . . . . . . . table.

Q. User accounts may be altered and dropped using the . . . . . . . . Query Language.

Q. ZooKeeper allows distributed processes to coordinate with each other through registers, known as . . . . . . . .

Q. Which of the following is a singleton instance class?

Q. What is the purpose of the Hadoop RecordReader in a MapReduce job?

Q. Maximum virtual memory of the launched child-task is specified using . . . . . . . .

Q. . . . . . . . . is percentage of memory relative to the maximum heap size in which map outputs may be retained during the reduce.

Q. What is the role of the Combiner in the MapReduce model?

Q. What is the role of the Hadoop Secondary NameNode in MapReduce?

Q. . . . . . . . . systems are scale-out file-based (HDD) systems moving to more uses of memory in the nodes.

Q. Which Hadoop ecosystem tool is used for managing and monitoring Hadoop clusters?

Q. What is the purpose of the ResourceManager in Hadoop YARN?

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

Q. . . . . . . . . generates keys of type LongWritable and values of type Text.

Q. Which of the following command is used to dump the log container?

Q. In . . . . . . . . the default job is similar, but not identical, to the Java equivalent.

Q. Point out the correct statement.

Q. Point out the correct statement.

Q. Point out the correct statement.

Q. Point out the wrong statement.

Q. The file to which data is write is referred to as . . . . . . . .

Q. when we declare the variable in a Particular control of vb then it is . . . . . . . . variable .

Q. In VB ,We can use Public or Dim statement to declare an array .

Q. A . . . . . . . . loop is a loop whose processing is controlled by a counter.

Q. The . . . . . . . . selection structure allows the programmer to specify that a different action is to be performed when the condition is True than when the condition is False.

Q. In Visual Basic . . . . . . . . is used for coding single-alternative and dual-alternative selection structures.

Q. The size property contains two numbers separated by comma, and a space. These numbers are . . . . . . . .

Q. . . . . . . . . is an underscore that is immediately preceded by a space and is located at the end of the physical line of code.

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

Q. . . . . . . . . menu is open by right button of the mouse .

Q. The programmer use . . . . . . . . property to refer to menu element in code.

Q. Where does the form's Text Property appear?

Q. Is there an error in the below code?

Q. The long form of SDI is . . . . . . . .

Q. The . . . . . . . . in a pattern represents zero or more characters.

Q. A . . . . . . . . is an item of data whose values do not change while the application is running.

Q. A variable's . . . . . . . . indicates where the variable can be used in an application code.

Q. Which of the following statements pauses program execution for 1 second?

Q. What will be the content of Text after the code is executed with id=2?

Q. What will be the output of the following Visual Basic code?

Q. Using a named constant is advantageous because to change a value in future, change . . . . . . . .

Q. . . . . . . . . variables of a class are not visible to applications that use the instance of that class.

Q. In VB, The. . . . . . . . function converts all the characters of a string to capital letters.

Q. Which option is used to align two or more controls by their left, right, top or bottom borders?

Q. . . . . . . . . uses short phrases to describe the steps the procedure must take.

Q. The . . . . . . . . validator is used to verify that a control contains data.

Q. The long form of MDI is. . . . . . . ..

Q. String data type can store from zero to . . . . . . . . Unicode characters.

Q. when we declare the variable in . . . . . . . . of VB then it is public variable

Q. MDI is used to work as parents, its main property is . . . . . . . . , all the forms are open within MDI

Q. . . . . . . . . the documentation refers to putting the documentation in a safe place.

Q. What does namespace contain?

Q. In . . . . . . . . first we execute the true statement . then we check the condition if the condition is true then it again execute the true statement .

Q. ControlChars.NewLine constant is a . . . . . . . . constant.

Q. Who displays the item contained in each project?

Q. The . . . . . . . . setting removes the form border.

Q. In R, what is the purpose of the if-else statement?

Q. JSPs eventually are compiled into Java servlets, you can do as much with JSPs as you can do with Java servlets.

Q. The sendRedirect() method of HttpServletResponse interface can be used to redirect response to another resource, it may be servlet, jsp or html file

Q. Which action tags are used in JSP for developing web application with Java Bean?

Q. Which package is used for Remote Method Invocation (RMI)?

Q. What is the purpose of the 'find' command in Linux?

Q. Which command is used to add a new group in Linux?

Q. Which file contains the configuration for the system hostname in Linux?

Q. Which of the following cannot be overloaded in C++?

Q. Which function is used to write data to a file in C++?

Q. What does the 'static' keyword do when applied to a local variable inside a function?

Q. Which of the following is not a feature of object-oriented programming in C++?

Q. Which of the following is a correct declaration of a C++ array?

Q. Which of the following is not a valid C++ identifier?

Q. Which operator is used to access a pointer's value in C++?

Q. Which of the following C++ features allows a class to inherit from another class?

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

Q. Which of the following is the correct way to declare a reference 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 move assignment operator in C++?

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

Q. Which of the following is not a valid C++ data type?

Q. Which of the following is a valid C++ identifier?

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

Q. What will be the output of the following code: print(3 // 2)?

Q. What will be the output of the following Python code: print('Hello' * 3)?

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

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

Q. Which of the following is true about Docker containers?

Q. Which Docker command is used to view detailed information about a container?

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

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

Q. Which Docker command is used to remove all stopped containers?

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

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

Q. Which of the following is NOT a valid Docker command?

Q. Which of the following commands lists all the Docker networks?

Q. Which of the following is a valid Docker command to view the logs of a container?

Q. What is Docker Swarm?

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

Q. Which Docker command is used to get the stats of running containers?

Q. What does the '--detach' or '-d' flag do when running 'docker run'?

Q. How can you scale a service in Docker Compose?

Q. What does the 'docker ps' command display?

Q. What is the purpose of Docker Compose?

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

Q. Which command is used to view the current Docker Compose configuration?

Q. Which of the following commands is used to execute a command inside a running Docker Compose container?

Q. What is the default network mode for services in Docker Compose?

Q. How do you define the network settings for a service in Docker Compose?

Q. Which of the following is a valid restart policy in Docker Compose?

Q. What is the default name of the Docker Compose configuration file?

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

Q. Which command is used to unpause a paused Docker container?

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

Q. What is Docker Hub?

Q. ‐‐‐‐‐‐‐ can represent items of varying data types to an item.

Q. Tne multiple use of input and output operator is called …………….

Q. A function calling itself

Q. A static variable is initialized to ‐‐‐‐‐when the first object of its class is created.

Q. ‐‐‐‐‐‐‐‐ are normally used to maintain values common to the entire class.

Q. ‐‐‐‐‐‐‐ is the actual body of the function

Q. ‐‐‐‐‐‐‐‐‐‐‐ Statement used to branch unconditionally from one point to another in the program.

Q. int d=int (a) + int (b);This statement is an example of ‐‐‐‐‐‐‐

Q. ‐‐‐‐‐ statement is used to print a blank line in CPP program

Q. By default, the members of a C++ class are:

Q. Constructors __________ to allow different approaches of object construction.

Q. Which of the following statement is correct?

Q. Which of the following also known as an instance of a class?

Q. Which of the following statement is correct with respect to the use of friend keyword inside a class?

Q. The function contain in the class iomanip to fill characters in the un used space

Q. The function contain in the ios class to set width

Q. Which function is in the istream class

Q. The keyword to convert pointer into non pointer & non pointer into pointer

Q. The pointer refers to an object that has called the member function currently

Q. How do you display the kernel release?

Q. Which command is used to unmount a filesystem?

Q. What command is used with file named 'letter' to remove the executable permission from the user and assign read permission to the group and others?

Q. The IP address are based on

Q. Which command reduces the size of a file?

Q. Which of the following commands can be used to change the group owner of a file?

Q. Command used to create an empty file.

Q. How do you copy an entire directory structure? E.g. from Project to Project.backup

Q. The statement print f ("%d", 10 ? 0 ? 5 : 1 : 12); will print?

Q. What is the output of the following? def to_upper(k): return k.upper() x = ['ab', 'cd'] print(list(map(to_upper, x)))

Q. Is it fine to call delete twice for a pointer? #include<iostream> using namespace std; int main() { int *ptr = new int; delete ptr; delete ptr; return 0; }

Q. How to create a dynamic array of pointers (to integers) of size 10 using new in C++? Hint: We can create a non-dynamic array using int *arr[10]

Q. Which of the following operators cannot be overloaded?

Q. Which of the following is not a member of class?

Q. class Test { int x; }; int main() { Test t; cout << t.x; return 0; }

Q. Identify the user-defined types from the following?

Q. Which of the following is true about templates? 1) Template is a feature of C++ that allows us to write one code for different data types. 2) We can write one function that can be used for all data types including user defined types. Like sort(), max(), min(), ..etc. 3) We can write one class or str

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

Q. captive requires that the cloud accommodate multiple compliance regimes.

Q. Which of the following is Type 2 VM ?

Q. What security threats do employee-owned devices pose by storing corporate data and accessing corporate networks?

Q. The percentage of time the system is up and running smoothly is referred as .

Q. To establish scalability for the analysis of huge research data, CERN uses LSF i.e. a grid and workload management solution of cloud computing platform

Q. Point out the correct statement.

Q. In distributed system, each processor has its own

Q. Which of the following cloud concept is related to pooling and sharing of resources?

Q. systems used to track and identify the location of objects in real time

Q. Point out the correct statement.

Q. method publishes messages to pub/sub.

Q. CXF represents the consolidation of the Celtix and XFire projects, which each had useful SOAP support.

Q. Amazon Machine Images are virtual appliances that have been packaged to run on the grid of nodes.

Q. Dynamodb is type of storage

Q. Network bottlenecks occur when data sets must be transferred

Q. Which of the following is a compliance standard?

Q. Which of the following layers are defined by the ZigBee stack?

Q. is the technology used to search tagged objects and mobile devices with the help of browsing an IP address or using the database entry

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. Data stored in domains doesn’t require maintenance of a schema.

Q. Annotation which allows the Jaxb2Marshaller marshaller to detect a class’s (i.e., object’s) fields.

Q. Point out the wrong statement.

Q. The property states that the system must have a mechanism to recover from committed transactions should that be necessary.

Q. offers various Linux distributions upon which you can build a virtual machine.

Q. allows different operating systems to run in their own memory space.

Q. Which of the following is the highest degree of integration in cloud computing?

Q. enables batch processing, which greatly speeds up high-processing applications.

Q. A service that concentrates on hardware follows the as a Service model.

Q. Which of the following provide system resource access to virtual machines?

Q. The right level of parallelism for maps seems to be around maps per- node.

Q. A is a logical unit that serves as the target for storage operations, such as the SCSI protocol READs and WRITEs.

Q. In _______ the virtual machine simulates hardware, so it can be independent of the underlying system hardware.

Q. Which of the following is the machinery for interacting with Amazon’s vast product data and eCommerce catalog function?

Q. Cloud computing networks are designed to support only private or hybrid clouds.