All questions
- What will be the output of the following Java code? Answer: a Explanation: Operator ++ has more preference than *, thus g becomes 4 and when multiplied by 8 gives 32. 1
- What is the extension of java code files? a) .js b) .txt c) .class d) .java Answer: d Explanation: Java files have .java extension. 2
- Which of these cannot be used for a variable name in Java? a) identifier & keyword b) identifier Answer: c Explanation: Keywords are specially reserved words that can not be used for naming a user-defined variable, for example: class, in... 1
- Which one of the following is not a Java feature? a) Object-oriented Answer: b Explanation: Pointers is not a Java feature. Java provides an efficient abstraction layer for developing without using a pointer i... 1
- Which component is used to compile, debug and execute the java programs? a) JRE b) JIT c) JDK d) JVM Answer: c Explanation: JDK is a core component of Java Environment and provides all the tools, executables and binaries required to compile,... 1
- Which statement is true about Java? a) Java is a sequence-dependent programming language Answer: d Explanation: Java is called ‘Platform Independent Language’ as it primarily works on the principle of ‘compile once, run everywher... 1
- Who invented Java Programming? a) Guido van Rossum b) James Gosling c) Dennis Ritchie d) Bjarne Stroustrup Answer: b Explanation: Java programming was developed by James Gosling at Sun Microsystems in 1995. James Gosling is well known as the fathe... 1
- C Program to find Sum of Diagonal Elements of a Matrix #include<stdio.h> int main() int i, j, rows, columns, a[10][10], Sum = 0; printf("n Please Enter Number of rows and columns : "); scanf("%d... 1
- C Program to Find Hcf and Lcm of Two Numbers #include <stdio.h> #include <conio.h> int main() int a, b, num1, num2, temp, gcd, lcm; printf("Enter two numbersn"); scanf("%d %d", &a, &b);... 1
- C Program to Calculate Power of a Number #include <stdio.h> int main() { int base, exp; long double result = 1.0; printf("Enter a base number: "); scanf("%d", &base); printf("Enter... 1
- C Program to Check Armstrong Number #include <stdio.h> #include <conio.h> int main() int number, sum = 0, lastDigit, temp; printf("Enter a number : "); scanf("%d", &number); te... 2
- C programto check whether a word is palindrome or not.. #include<stdio.h> #include<conio.h> #include<string.h> int main() char str[20]; int i, len, temp=0; int flag = 0; printf("Enter a string:");... 1
- C Program to Swap Two Numbers #include <stdio.h> #include <conio.h> int main() int firstNumber, secondNumber, temp; printf("Enter two numbers n"); scanf("%d %d", &firstNu... 1
- C Program to Reverse Digits of a Number #include <stdio.h> #include <conio.h> int main() int number, reverse = 0, rightDigit; printf("Enter a number n"); scanf("%d", &number); whil... 1
- C Program to Check Odd or Even Numbers #include <stdio.h> #include <conio.h> int main() int number; printf("Enter a number n"); scanf("%d", &number); if(number%2 == 1) // Input nu... 2
- C Program to Find Square Root of a Number using sqrt Function #include <stdio.h> #include <math.h> int main () double x, result; printf("Enter a numbern"); scanf("%lf", &x); result = sqrt(x); printf("Sq... 1
- C Program to Print Digits of a Number in English Words #include<stdio.h> #include<conio.h> void printDigit(int digit); int main() int reverse = 0, digit, num, mod; printf("Enter a positive Intege... 2
- C Program to Print Fibonacci Series #include <stdio.h> #include <conio.h> int main(){ int terms, lastNumber=1,secondLast=0,currentNumber=0,counter; printf("Enter number of term... 1
- C Program to Print Current Date and Time #include <time.h> #include <stdio.h> #include <conio.h> int main(void) { time_t current_time; char* c_time_string; current_time = time(NULL)... 1
- C Program to Check Year is Leap Year or Not #include <stdio.h> #include <conio.h> int main() int year; printf("Enter a year for leap year checkn"); scanf("%d", &year); if(year%4 != 0)... 1
- C Program to Find the Sum of First N Natural Numbers Answer: Read N and add 1, 2, 3, ..., N in a loop (the result equals N(N+1)/2 ). #include <stdio.h> int main(void) int n, i; long sum = 0; pr... 1
- C Program to Add Two Numbers Using Pointers #include <stdio.h> #include <conio.h> int main() int firstNumber, secondNumber, sum; /* Pointers declaration */ int *firstNumberPointer, *se... 1
- C Program for Input/Output of Integer, Character and Floating point numbers #include <stdio.h> #include <conio.h> int main() int inputInteger; char inputCharacter; float inputFloat; printf("Enter an Integer, Characte... 1
- C Program to Check Whether an Alphabet is Vowel or Consonant #include <stdio.h> #include <conio.h> int main() char c; printf("Enter a Character: "); scanf("%c", &c); if(c == 'a' || c == 'e' || c =='i'... 1