Pointers Strings and Basics Test-Learning Java Language-Quiz, Exercises of Java Programming

This assignment is for Learning Java Language course by Suryavanshi Vikram at Cochin University of Science and Technology. It includes: Object-oriented, Programming, Data, Structures, Declaration, Pointer, Memory, Address, Function, Compare

Typology: Exercises

2011/2012

Uploaded on 07/12/2012

yumna
yumna 🇮🇳

4.8

(4)

12 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Object Oriented Programming and Data Structures Lab
Test 1
Objective
1. Which of the following is the proper declaration of a pointer?
A. int x;
B. int &x;
C. ptr x;
D. int *x;
2. Which of the following gives the memory address of integer variable a?
A. *a;
B. a;
C. &a;
D. address(a);
3. Which of the following gives the memory address of a variable pointed to by pointer a?
A. a;
B. *a;
C. &a;
D. address(a);
4. Which of the following gives the value stored at the address pointed to by pointer a?
A. a;
B. val(a);
C. *a;
D. &a;
5. Which of the following functions compares two strings?
A. compare();
B. stringcompare();
C. cmp();
D. strcmp();
6. Which of the following adds one string to the end of another?
A. append();
B. stringadd();
C. strcat();
D. stradd();
7. Which of the following is a string literal?
A. Static String
B. "Static String"
C. 'Static String'
D. char string[100];
8. What character ends all strings?
A. '.'
B. ' '
Docsity.com
pf3

Partial preview of the text

Download Pointers Strings and Basics Test-Learning Java Language-Quiz and more Exercises Java Programming in PDF only on Docsity!

Object Oriented Programming and Data Structures Lab

Test 1

Objective

  1. Which of the following is the proper declaration of a pointer? A. int x; B. int &x; C. ptr x; D. int *x;
    1. Which of the following gives the memory address of integer variable a? A. *a; B. a; C. &a; D. address(a);
    2. Which of the following gives the memory address of a variable pointed to by pointer a? A. a; B. *a; C. &a; D. address(a);
    3. Which of the following gives the value stored at the address pointed to by pointer a? A. a; B. val(a); C. *a; D. &a;
    4. Which of the following functions compares two strings? A. compare(); B. stringcompare(); C. cmp(); D. strcmp();
    5. Which of the following adds one string to the end of another? A. append(); B. stringadd(); C. strcat(); D. stradd();
    6. Which of the following is a string literal? A. Static String B. "Static String" C. 'Static String' D. char string[100];
    7. What character ends all strings? A. '.' B. ' '

C. '\0'

D. '\n'

  1. Which is not a proper prototype? A. int funct(char x, char y); B. double funct(char x) C. void funct(); D. char x();
  2. which of the following is a valid function call (assuming the function exists)? A. funct; B. funct x, y; C. funct(); D. int funct();