Home / Bhagwan Das / Programming MCQs Solution

Programming Portal Solution

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

Q. Predict the output: public class Test{ public static void main(String args[]){ try{ String arr[] = new String[10]; arr = null; arr[0] = "one"; System.out.print(arr[0]); }catch(Excepti

Q. What will be the output of the following Java code? class exception_handling { public static void main(String args[]) { try { throw new NullPointerException ("Hello"); } catch(ArithmeticException e) { System.out.print(&qu

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

Q. Which is true?

Q. A class member declared protected becomes a member of subclass of which type?

Q. Which of this keyword must be used to inherit a class?

Q. What will be the output of the following Java program? interface calculate { void cal(int item); } class displayA implements calculate { int x; public void cal(int item) { x = item * item; } } class displayB implements calculate { int x; public void ca

Q. Which of these methods return a class object given its name?

Q. Does code Segment loads the java code?

Q. What will be the output of the following Java program? import java.lang.System; 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, 2, b, 3, a.length - 4);

Q. Which of these method returns a largest whole number less than or equal to variable X?

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

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 = a.getClass(); System.out

Q. What will be the output of the following Java program? package pkg; class display { int x; void show() { if (x > 1) System.out.print(x + " "); } } class packages { public static void main(Stri

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

Q. Which of these is a process of converting a simple data type into a class?

Q. What will be the output of the following Java code snippet? int a = random.nextInt(7) + 4;

Q. Which of these is a method can generate a boolean output?

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

Q. Which of this access specifies can be used for a class so that its members can be accessed by a different class in the same package?

Q. Which of the following package stores all the standard java classes?

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

Q. What will be the output of the following Java program? (Note: file is made in c drive.) import java.io.*; class files { public static void main(String args[]) { File obj = new File("/java/system"); System.out.print(obj.canWrite()); System.out.print("

Q. Which of these methods returns the class of an object?

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.floor(x); System.out.print(y); } }

Q. Which of these methods is not a Locale class?

Q. Which of these is a super class of wrappers Double & Integer?

Q. Which of these is a wrapper for simple data type char?

Q. Which of these class contains all the methods present in Math class?

Q. What will be the output of the following Java program? import java.io.*; class Chararrayinput { public static void main(String[] args) { String obj = "abcdefgh"; int length = obj.length(); char c[] = new char[length]; obj.getChars(0, length, c, 0);

Q. What is a "static" method in Java?

Q. In Java, can a constructor have a return type?

Q. What is a non-static (instance) method in Java?

Q. public class MyClass{ } For the above class(MyClass) what is the correct way of declaring constructor?

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

Q. Which exception is thrown when java is out of memory?

Q. Which of these keywords is used to make a class?

Q. Which operator is used for division in Java?

Q. What is the result of the expression 7 / 0 in Java?

Q. Which of these is not a bitwise operator?

Q. How do you check if a string contains a specific character in Java?

Q. The class string belongs to ................. package.

Q. Which of these methods of class String is used to check whether a given object starts with a particular string literal?

Q. What will s2 contain after following lines of Java code?

Q. What will be the output? String str1 = "abcde"; System.out.println(str1.substring(1, 3));

Q. Which of these data type value is returned by equals() method of String class?

Q. What will be the output of the following Java program? class output { public static void main(String args[]) { String s1 = "one"; String s2 = s1 + " two"; System.out.println(s2); } }

Q. Determine output: public class Test{ public static void main(String[] args){ int[] x = {1, 2, 3, 4}; int[] y = x; x = new int[2]; for(int i = 0; i < x.length; i++) System.out.print(y[i] + " &quo

Q. What is output of the following code: public class Test{ public static void main(String[] args){ int[] x = {120, 200, 016 }; for(int i = 0; i < x.length; i++) System.out.print(x[i] + " "); } }

Q. What will be the output of the following Java code? int arr[] = new int [5]; System.out.print(arr);

Q. What will be the output of the program? public class Test{ public static void main(String [] args){ String s1 = args[1]; String s2 = args[2]; String s3 = args[3]; String s4 = args[4]; System.out.print(" args[2] = " + s2);

Q. What is the access level of a class member declared as private in Java?

Q. Which access modifier allows a class member to be accessed from any class in the same package but not from outside?

Q. Choose all the lines which if inserted independently instead of "//insert code here" will allow the following code to compile: public class Test{ public static void main(String args[]){ add(); add(1); add(1, 2); } // insert code here }

Q. What is the output for the below code? public class A{ static{ System.out.println("static"); } { System.out.println("block"); } public A(){ System.out.println("A"); } public static void mai

Q. What is the output for the below code? public class Test{ int _$; int $7; int do; public static void main(String argv[]){ Test test = new Test(); test.$7=7; test.do=9; System.out.println(test.$7); System.out.println

Q. How to format date from one form to another?

Q. What will be the output of the following Java statement? class output { public static void main(String args[]) { double a, b,c; a = 3.0/0; b = 0/4.0; c=0/0.0; System.out.println(a); System.out.println(b);

Q. What will be the output of the following Java program? class c { public void main( String[] args ) { System.out.println( "Hello" + args[0] ); } }

Q. What will be the output of the following Java code? class average { public static void main(String args[]) { double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5}; double result; result = 0; for (int i = 0; i < 6; ++i) result = result + num[i]; Sys

Q. Which statement can produce the same output as 'SHOW COLUMNS'?

Q. The NULL value also means . . . . . . . .

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

Q. The operator that compares sounds is . . . . . . . .

Q. The slave stores the CHANGE MASTER parameters in the file . . . . . . . .

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

Q. What is the meaning of "NULL" in Mysql?

Q. When no modes are enabled, what does this SQL statement return? SELECT @@SESSION.sql_mode;

Q. All API calls return a value.

Q. Which statement is used to create a trigger?

Q. Suppose a stored function named PI() is written in the database 'sampdb'. How would it be called?

Q. On failure, 'mysql_query()' returns . . . . . . . .

Q. How many among the following does not return a value? mysql_close(), mysql_init, mysql_real_connect

Q. The privilege that must be given to the database to create a stored function or procedure is . . . . . . . .

Q. What will be the output of the following MySQL statement? SELECT account_id, product_id, cust_id FROM account WHERE product_id NOT IN (‘sav’, ‘chd’, ‘mm’);

Q. 'x' in the following MySQL statement is . . . . . . . . DELETE FROM x USING x LEFT JOIN y ON x.col = y.col;

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

Q. What does the AUTO_INCREMENT sequences begin at by default?

Q. The option necessary to compile a C program havin math functions is . . . . . . . .

Q. Is the following statement is true/false? "An expression can be NULL, but can never equal to NULL"

Q. What does 'name' represent in the following SQL code snippet? CREATE TABLE student ( name CHAR(30), roll_num INT, address CHAR(30), phone CHAR(12) );

Q. When building from source, the embedded server library is enabled by . . . . . . . .

Q. The expression 12 DIV 5 evaluates to . . . . . . . .

Q. What is abc in the following SQL statement? DELETE FROM xyz WHERE abc = 5;

Q. Before relocation of database, the server should be stopped if running.

Q. Which command is used to remove existing tables or database?

Q. Which operators are used when a subquery returns multiple rows to be evaluated in comparison to the outer query?

Q. Which spatial datatype is used to store a curve?

Q. In the following MySQL command how many rows will be updated? UPDATE person SET lname=’s’, Fname = ’p’, WHERE person_id = 1; /* person_id is a primary key */

Q. What is the significance of the statement "GROUP BY d.name" in the following MySQL statement? SELECT d.name, COUNT (emp_id) emp_no FROM department d INNER JOIN Employee e ON d.dept_id=e.emp_id GROUP BY d.name

Q. Which of these has a bigger memory footprint? Perl, PHP

Q. The number of options that can be used to control LOCAL capability at runtime is . . . . . . . .

Q. Which operator is used to perform integer divisions in MySQL?

Q. The one that is not optional is . . . . . . . . SELECT select_list FROM table_list WHERE row_constraint GROUP BY grouping_columns;

Q. UPDATE statement is a DML statement. What does DML stand for?

Q. When no AUTO_INCREMENT value has been generated during the current connection, LAST_INSERT_ID() returns . . . . . . . .

Q. The higher priority is . . . . . . . . writes, reads

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

Q. How many of the following use NULL to indicate failure? mysql_init(), mysql_real_connect()

Q. What is the creation of a stored program similar to?

Q. The command which lists databases managed by the server is . . . . . . . .

Q. In the following MySQL command how many rows will be deleted? DELETE person WHERE person_id<10; /*person_id is a primary key */

Q. What is the output from PHP?

Q. Which among the following can also be included with "SELECT" clause while writing query in Mysql?

Q. Which option suppresses output unless there are errors in the table?

Q. Which of these is preferred when stored procedures are not being used? CLIENT_MULTI_STATEMENTS, mysql_set_server_option()

Q. SPATIAL indexes cannot be created on NOT NULL spatial columns.

Q. What will be the output of the following MySQL statement "false AND Null"?

Q. Which of the following are the valid "database datatypes" in Mysql?

Q. A stored program associated with a schedule is . . . . . . . .

Q. 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, the security context is . . . . . . . .

Q. Which of the following columns is not returned by 'OPTIMIZE TABLE'?

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

Q. Which Statement is used to insert the values in the table?

Q. Which statement upgrades the database directory name encoding?

Q. Which operator is used to return value from JSON columns after evaluating the path and unquoting the result?

Q. The statement used to select a default database is . . . . . . . .

Q. The LOCAL capability for client library is enabled by . . . . . . . .

Q. Which of the following statements is/are correct with respect to "VIEW"?

Q. Which of the following statement is false?

Q. You were giving your presentation, and you need to click a slide that's few slides back. How do you get there?

Q. Which of the following is not a feature of PowerPoint?

Q. Microsoft Office SharePoint Designer is used for

Q. It is a Note-taking software for use with tab- let PCs or regular PCs.

Q. In NiFi, what is the function of the "controller service"?

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

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

Q. What is the primary benefit of using NiFi's "SplitContent" processor in a data flow?

Q. What is the purpose of NiFi's "PutFile" processor in a data flow?

Q. How does Hadoop's HDFS Federation contribute to security in a Hadoop cluster?

Q. What is the purpose of Hadoop's Secure DataNode?

Q. How can you enforce secure data transmission between a Hadoop client and the ResourceManager?

Q. How can Hadoop's Kerberos-based authentication improve the security of a Hadoop cluster?

Q. . . . . . . . . sink can be a text file, the console display, a simple HDFS path, or a null bucket where the data is simply deleted.

Q. A . . . . . . . . is an operation on the stream that can transform the stream.

Q. All file access uses Java's . . . . . . . . APIs which give Lucene stronger index safety.

Q. Spark includes a collection over . . . . . . . . operators for transforming data and familiar data frame APIs for manipulating semi-structured data.

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

Q. In HBase, what is the purpose of the ROWKEY?

Q. What is the primary role of the HBase Compaction Scheduler?

Q. In Oozie, what is the role of the "transition" element in a decision node?

Q. Point out the correct statement.

Q. Conceptually, each . . . . . . . . emits a semi-infinite stream of bytes, numbered starting from zero.

Q. . . . . . . . . allows database-like access, and in particular a SQL interface.

Q. Point out the wrong statement.

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

Q. What is the role of the Hive CLI (Command-Line Interface) in Apache Hive?

Q. In Hive, what is the function of the LATERAL VIEW statement?

Q. Which is the additional command line option is available in Hive 0.10.0?

Q. HiveServer2 introduced in Hive 0.11 has a new CLI called . . . . . . . .

Q. What is the significance of the Hadoop AvroOutputFormat?

Q. The . . . . . . . . class extends and implements several Hadoop-supplied interfaces.

Q. . . . . . . . . facilitates construction of generic data-processing systems and languages.

Q. . . . . . . . . data file takes is based on avro serialization framework which was primarily created for hadoop.

Q. The . . . . . . . . file is populated with the key and a LongWritable that contains the starting byte position of the record.

Q. Point out the correct statement.

Q. HDFS, by default, replicates each data block . . . . . . . . times on different nodes and on at least . . . . . . . . racks.

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

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

Q. In Pig, what is the function of the Pig Latin UNION statement?

Q. In Pig, what is the significance of the CROSS statement?

Q. In Pig, what is the primary function of the Pig Latin TOKENIZE function?

Q. Point out the wrong statement.

Q. . . . . . . . . is a framework for collecting and storing script-level statistics for Pig Latin.

Q. . . . . . . . . abstract class has three main methods for loading data and for most use cases it would suffice to extend it.

Q. . . . . . . . . are scanned in the order they are specified on the command line.

Q. Which of the following code is used to find scripts that use only the default parallelism?

Q. Point out the wrong statement.

Q. Point out the correct statement.

Q. In Flume, what is the role of a Flume Sink?

Q. Cassandra marks data to be deleted using . . . . . . . .

Q. When a . . . . . . . . is triggered the client receives a packet saying that the znode has changed.

Q. Which Apache project is commonly used for real-time data processing in Hadoop?

Q. . . . . . . . . jobs are optimized for scalability but not latency.

Q. In MapReduce, what is the purpose of the Map task?

Q. Hadoop data is not sequenced and is in 64MB to 256MB block sizes of delimited record values with schema applied on read based on . . . . . . . .

Q. Which Hadoop ecosystem tool is used for querying and analyzing large datasets?

Q. What is the primary purpose of Hadoop MapReduce?

Q. Which of the following writes MapFiles as output?

Q. The key, a . . . . . . . . is the byte offset within the file of the beginning of the line.

Q. . . . . . . . . is a variant of SequenceFileInputFormat that converts the sequence file's keys and values to Text objects.

Q. Point out the correct statement.

Q. Point out the correct statement.

Q. . . . . . . . . takes node and rack locality into account when deciding which blocks to place in the same split.

Q. Which of the following is the default output format?

Q. Which of the following is only for storage with limited compute?

Q. Yarn commands are invoked by the . . . . . . . . script.

Q. Letter . . . . . . . . is a File's Menu access keys.

Q. Files that read and write in consecutive order are known as . . . . . . . .

Q. To traverse two dimensional array you require . . . . . . . . loops.

Q. The InputBox functions prompt argument should be entered using . . . . . . . .

Q. The lines connecting the symbols in a flowchart are called as . . . . . . . .

Q. . . . . . . . . method is used to remove specified number of characters located anywhere in the String.

Q. What is wrong with the expression "static dblPi AsDouble"?

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

Q. While entering a numeric literal constant you need not enter a . . . . . . . .

Q. Which of the following type of constant is ControlChars.NewLine constant?

Q. . . . . . . . . capitalization is used for menu item captions.

Q. The . . . . . . . . event occurs when the user either types a value in the text portion of a combo box or selects a different item in the list portion.

Q. What will be the content of num, after code execution; if before code execution num has value 1000?

Q. How many times will the MessageBox.Show method in the following code be processed?

Q. A checkbox can be directly accessed from the keyboard using a . . . . . . . .

Q. The purpose of . . . . . . . . is to process code at one or more regular intervals.

Q. The size property contains the size of . . . . . . . .

Q. A function can receive information either by value or by . . . . . . . .

Q. A text box's . . . . . . . . property specifies whether the text box has scroll bar.

Q. . . . . . . . . in flowchart is used to represent a for clause.

Q. . . . . . . . . is data type that can be used to declare a text of maximum 10 million.

Q. When a value is converted from one data type to another and can store numbers with less precision, the value is said to be . . . . . . . .

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

Q. The text box's . . . . . . . . event procedure prevents user from entering a specified character.

Q. To delete . . . . . . . . you must delete the contents of the form's text property.

Q. . . . . . . . . is used to open a sequential access file for output.

Q. . . . . . . . . button is used to select a control from the form.

Q. The requirement for repeating the instructions is referred to as the . . . . . . . .

Q. . . . . . . . . is used to open the sequential file access for append.

Q. To pass a variable by value, you include the keyword . . . . . . . . before the name of its corresponding parameter.

Q. Reading data from a file is referred to as . . . . . . . .

Q. Named constants are used because . . . . . . . .

Q. Which of the following method is used to sort an array in visual basic?

Q. Selection structures that can select from many alternatives are known as . . . . . . . .

Q. In . . . . . . . . , The size of array always remains the same-size doesn't change during the program execution.

Q. The . . . . . . . . validator is used to verify that control contains data verify that an entry passes the specified validation logic.

Q. A . . . . . . . . provides an area in the form for the user to enter data.

Q. in . . . . . . . . we can edit in run time

Q. If the padCharacter is omitted from the syntax of the padLeft or PadRight, the default is . . . . . . . .

Q. You use the . . . . . . . . tool to add a checkbox to a form.

Q. If you have an existing package that doesn't have an .Rproj file, you can use devtools for the use_rstudio(". . . . . . . ./to/package") to add it.

Q. How is a character string defined in R?

Q. Which of the variables serve as symbolic constants