1.
What is the correct value to return to the operating system upon successful completion of a program in c?
Correct Answer
A. 0
Explanation
In the C programming language, the correct value to return to the operating system upon successful completion of a program is 0. This convention is followed to indicate that the program executed successfully without any errors or issues. By returning 0, it signifies that the program completed its execution as expected and can be considered a successful termination.
2.
What will be the output after execution of following code?#include<stdio.h>#include<stdlib.h>int main(){char ch;int i;ch='G';i=ch-'A';printf("%d",i);}
Correct Answer
C. 6
Explanation
The code is written in C and it is trying to find the difference between the ASCII values of the characters 'G' and 'A'. In ASCII, the value of 'G' is 71 and the value of 'A' is 65. Therefore, the difference between them is 6. The code then prints the value of 'i', which is 6.
3.
What is the output of following code in c?#include#includeint main(){int i=0678;printf("%d",i);return 0;}
Correct Answer
C. Compilation error
Explanation
The code will produce a compilation error because the number 0678 is an invalid octal number. In C, octal numbers must start with a leading zero followed by valid octal digits (0-7). Since 8 is not a valid octal digit, the code will fail to compile.
4.
"My salary was increased 15%"Select the statement which will EXACTLY reproduce above line.
Correct Answer
D. Printf("My salary was increased 15%%");
Explanation
The correct answer is printf("My salary was increased 15%%"). This statement will exactly reproduce the given line because the double percent sign (%%) is used in printf to print a single percent sign.
5.
What is the output of following?#include <stdio.h>#include <stdlib.h>int main() { char str[] = "Smaller"; int a = 100; printf(a > 10 ? "Greater" : "%s", str); return 0;}
Correct Answer
A. Greater
Explanation
The output of the code is "Greater". This is because the printf statement uses a ternary operator to check if the value of 'a' is greater than 10. Since 'a' is equal to 100, which is greater than 10, the ternary operator evaluates to true and the printf statement prints "Greater".
6.
How many times below for loop will run?#include<stdio.h>int main(){int i=0;for(;;){printf("%d",i++);}return 0;}
Correct Answer
B. Infinite times
Explanation
The for loop in the given code does not have any condition specified in the second part of the loop declaration. As a result, the loop will continue to run indefinitely until it is terminated manually. Therefore, the for loop will run infinite times.
7.
What is the output of following?#include#includeint main(){int i=1;printf("%d%d%d",i++,i,++i);return 0;}
Correct Answer
B. Compiler dependent
Explanation
The output of this program is compiler dependent because the order of evaluation of the arguments in the printf statement is not defined. Different compilers may choose to evaluate the arguments in a different order, leading to different results. In this case, the arguments are i++, i, and ++i. Depending on the compiler, the order of evaluation could be 1, 2, 3 or 2, 2, 3. Therefore, the output could be either 124 or 223.
8.
Guess the output. #include<stdio.h>int main(){ int a = 100, b = 200, c = 300; if(!a >= 500) b = 300; c = 400; printf("%d,%d,%d",a, b, c); return 0;}
Correct Answer
B. 100,200,400
Explanation
The output of the program will be "100,200,400". This is because the condition in the if statement is false, as the value of "a" is 100 which is not greater than or equal to 500. Therefore, the statement inside the if block is not executed, and the values of "b" and "c" remain unchanged. The printf statement then prints the values of "a", "b", and "c", which are 100, 200, and 400 respectively.
9.
What is the output of following? #include<stdio.h> void main(){ int i = 1; while(i++<=5); printf("%d ",i);}
Correct Answer
A. 7
Explanation
The output of the given code is 7. This is because the while loop condition is i++
10.
Linker generate _________ file?
Correct Answer
C. Executable code
Explanation
The linker generates the executable code file. The linker is responsible for combining object code files, generated by the compiler, into a single executable file. This executable file contains the machine code that can be directly executed by the computer's processor. The linker resolves any unresolved symbols and addresses in the object code files, ensuring that all the necessary functions and variables are correctly linked together. Therefore, the correct answer is "Executable code".
11.
Which of the following is not a keyword in java?
Correct Answer
B. Boolean
Explanation
The keyword "Boolean" is not a keyword in Java. In Java, the keyword "boolean" (with a lowercase 'b') is used to declare a boolean variable, which can only have the values true or false. However, "Boolean" (with an uppercase 'B') is a wrapper class in Java that is used to wrap the primitive type boolean into an object. It provides methods for converting boolean values to strings and vice versa.
12.
What is the size of byte variable?
Correct Answer
A. 8 bit
Explanation
A byte variable is typically 8 bits in size. This means it can store a range of values from 0 to 255. It is the smallest unit of memory allocation in most programming languages and is commonly used to represent small integers or character data.
13.
What is static block?
Correct Answer
C. It is used to initialize the static data member and It is excuted before main method at the time of class loading.
Explanation
A static block is a block of code that is used to initialize static data members. It is executed before the main method at the time of class loading. This allows the static data members to be initialized before any other code is executed in the class. This is useful for setting up any necessary initial values or configurations for the static data members.
14.
What happens when thread's sleep() method is called?
Correct Answer
B. Thread returns to the waiting state.
Explanation
When a thread's sleep() method is called, the thread enters a waiting state. It temporarily suspends its execution for the specified amount of time, allowing other threads to execute. Once the sleep duration is over, the thread moves back to the ready state and can be scheduled by the operating system to run again. Therefore, the correct answer is that the thread returns to the waiting state.
15.
Which method of the Runnable interface that must be implemented by all threads?
Correct Answer
A. Run()
Explanation
All threads must implement the run() method of the Runnable interface. This method contains the code that will be executed when the thread is started. The start() method is used to start a thread, sleep() is used to pause the execution of a thread for a specified amount of time, and wait() is used for thread synchronization. However, only the run() method is mandatory for all threads.
16.
Specify the directory name where the XML layout files are stored in android.
Correct Answer
D. None of the Above
17.
Can We inflate multiple layout or fragment on the same screen?
Correct Answer
A. True
Explanation
Yes, we can inflate multiple layouts or fragments on the same screen in Android. This can be achieved by using ViewGroup containers such as LinearLayout, RelativeLayout, or FrameLayout, which allow multiple child views to be added and displayed simultaneously. By adding multiple layouts or fragments within these containers, we can create complex and dynamic user interfaces with multiple components displayed on the same screen.
18.
Which Build System/Tool is used to Build APK in Android Studio?
Correct Answer
A. Gradle
Explanation
Gradle is the build system/tool used to build APK files in Android Studio. Gradle is a powerful and flexible build automation tool that allows developers to define and customize their build process. It offers a rich set of features and plugins specifically designed for Android development, making it the preferred choice for building Android applications. Gradle simplifies the build process by managing dependencies, compiling code, and packaging resources into the final APK file. It also supports incremental builds and provides efficient caching mechanisms, resulting in faster build times.
19.
What is wrap_content Layout parameter.
Correct Answer
B. View wants to be just big enough to enclose its content (plus padding)
Explanation
The wrap_content layout parameter specifies that the view should be sized just enough to enclose its content, including any padding. This means that the view will adjust its size dynamically based on the size of its content, ensuring that it is not larger than necessary. The padding is also taken into account when determining the size of the view.
20.
Which database is Serverless and mostly used for Stand-alone Devices?
Correct Answer
B. SQLite
Explanation
SQLite is a serverless database that is mostly used for stand-alone devices. It is a self-contained, file-based database that does not require a separate server process to function. SQLite is widely used in embedded systems and mobile applications where there is a need for a lightweight and efficient database solution. It is a popular choice for devices with limited resources and where there is no need for a centralized server. Therefore, SQLite is the correct answer for this question.
21.
Who is known as father of pHP ?
Correct Answer
B. Rasmus Lerdraf
Explanation
Rasmus Lerdraf is known as the father of PHP. He created the PHP programming language in 1994 while he was a student at the University of Helsinki. Lerdraf originally developed PHP as a set of tools to manage his personal website, but it quickly gained popularity and evolved into a widely used scripting language for web development. Lerdraf's contributions to PHP have had a significant impact on the internet and have made him widely recognized as the father of PHP.
22.
How a variable declared in pHP ?
Correct Answer
C. $varname=value;
Explanation
The correct answer is $varname=value; because in PHP, variables are declared by using the dollar sign ($) followed by the variable name, then an equal sign (=) and finally the value assigned to the variable. This syntax is used to assign a value to a variable in PHP. The other options provided in the question are incorrect as they either miss the dollar sign or use incorrect capitalization.
23.
What will the following script output?<?php$array = array (1, 2, 3, 5, 8, 13, 21, 34, 55);$sum = 0;for ($i = 0; $i < 5; $i++) {$sum += $array[$array[$i]];}echo $sum;?>
Correct Answer
A. 78
Explanation
The script will output 78. The script initializes an array with numbers from 1 to 55. It then goes through a loop 5 times, adding the value of the element at the index given by the value of the current element to the sum. In this case, the values being added are $array[1], $array[2], $array[3], $array[5], and $array[8], which are 2, 3, 5, 13, and 55 respectively. The sum of these values is 78, which is then echoed.
24.
In pHP in order to access MySQL database you will use:
Correct Answer
C. Mysql_connect() function
Explanation
The correct answer is mysql_connect() function. This function is used in PHP to establish a connection with a MySQL database. It takes parameters such as the server name, username, password, and database name to connect to the MySQL server. Once the connection is established, you can perform various operations such as querying the database and manipulating data.
25.
The ............. statement is used to delete a table.
Correct Answer
A. Drop Table
Explanation
The correct answer is "Drop Table". This statement is used to delete a table in a database. By using the "Drop Table" command, the entire table and all its associated data and indexes are permanently removed from the database. It is a commonly used command in SQL to remove unwanted tables from the database schema.
26.
Which tag is used to print a line on your web page?
Correct Answer
B. Hr tag
Explanation
The correct answer is the hr tag. The hr tag is used to create a horizontal line on a web page. This tag is often used to separate content or sections on a page. The br tag is used to create a line break, not a horizontal line. The line tag is not a valid HTML tag. Therefore, the correct answer is the hr tag.
27.
How to make each word in a sentence start with a capital letter?
Correct Answer
C. Text-transform:capitalize
Explanation
The correct answer is "text-transform:capitalize" because this CSS property transforms the text to capitalize the first letter of each word in a sentence. This means that every word will start with a capital letter, while the rest of the letters remain lowercase. This is the appropriate property to use when you want to ensure consistent capitalization for each word in a sentence.
28.
Which css property is used to change the color of text in html?
Correct Answer
D. Color
Explanation
The correct answer is "color". This CSS property is used to change the color of text in HTML. It allows developers to specify the desired color using various formats such as color names, hexadecimal values, RGB values, or HSL values. By using the "color" property, the text color can be customized to match the desired design or style of the webpage.
29.
What is the full name of CSS ?
Correct Answer
B. Cascading Style Sheet
Explanation
CSS stands for Cascading Style Sheet. It is a style sheet language used for describing the look and formatting of a document written in HTML or XML. CSS allows web designers to control the presentation of web pages, including layout, colors, fonts, and other visual aspects. The correct answer is "Cascading Style Sheet".
30.
Which of the following is the extension used for external css property?
Correct Answer
D. .css
Explanation
The correct answer is ".css" because it is the file extension commonly used for external CSS (Cascading Style Sheets) files. CSS files are used to define the styling and layout of a webpage, and they can be linked to HTML documents using the tag in the section of the HTML document. By using the .css extension, it is easier for web developers to identify and manage their CSS files separately from other types of files in a project.